[Berkelium] auto generated API?

34 views
Skip to first unread message

Dennis Rieks

unread,
Oct 15, 2012, 6:22:41 PM10/15/12
to berk...@googlegroups.com
Hi,

i added an api.xml as the central definiton place for all supported
language bindings. the idea behind it is to have the same api in every
language and to prevent typos or missing functions in one language
binding. the plan is to extend this for IPC constans and everything
else we need.

also the api documentation can be managed here and automatically
inserted into the language bindings. then IDEs can display this help
as an tooltip...

please have a look here:
https://github.com/berkelium/berkelium/tree/master/berkelium-api/api

there is a api-c.xslt file which generates the include file below.

how do you find this approach?

todo:
* we need styleshees for other languages
* we need a script or progam that generates/updates all language
binding files from the api.xml file.

-Dennis


****************************************************************
// Copyright (c) 2012 The Berkelium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// =========================================
// WARNING:
// THIS FILE IS AUTOMATICALLY GENERATED!
// !! ANY CHANGES WILL BE OVERWRITTEN !!
//
// See berkelium/berkelium-api/update.sh
// =========================================

#ifndef BERKELIUM_API_H_
#define BERKELIUM_API_H_
#pragma once

#include <stdint.h>

typedef int32_t bk_int32;
typedef int32_t bk_bool;
typedef const char* bk_string;

typedef bk_int32 BK_HostVersion;
typedef bk_int32 BK_HostExecutable;

#ifdef __cplusplus
extern "C" {
#endif

// =========================================
// class HostVersion
// =========================================

// Returns the berkelium host version e.g. “22.0.1229.94”
bk_string BK_HostVersion_getVersionString(BK_HostVersion self);

// Returns the Major Version, e.g. “22”
bk_int32 BK_HostVersion_getMajor(BK_HostVersion self);

// Returns the Minor Version, always zero?
bk_int32 BK_HostVersion_getMinor(BK_HostVersion self);

// Returns the Build Version, e.g. “1229”
bk_int32 BK_HostVersion_getBuild(BK_HostVersion self);

// Returns the Patch Version, e.g. “94”
bk_int32 BK_HostVersion_getPatch(BK_HostVersion self);

// Returns true if the given Version is less or equal to the version
of the executable represented by this BerkeliumExecutable object.
bk_bool BK_HostVersion_isMinVersion(BK_HostVersion self, bk_string version);

// =========================================
// class HostExecutable
//
// Represents a reference to the executable file of the berkelium host process.
// =========================================

// Creates an BerkeliumHostExecutable Object representing the given executable.
BK_HostExecutable BK_HostExecutable_forExecutable();

// Creates an BerkeliumHostExecutable, the exectuable is searched
through system path or system configuration (e.g. registry on windows)
BK_HostExecutable BK_HostExecutable_forSystemInstalled();

// Returns the version of this berkelium host executable.
BK_HostVersion BK_HostExecutable_getVersion(BK_HostExecutable self);

// Returns the default profile for the given application name. A
profile can only be held open by one instance at the same time . An
exception is thrown of the profile is already be used.
BK_Profile BK_HostExecutable_forProfile(BK_HostExecutable self,
bk_string application);

// As above, but instead the given profile is used.
BK_Profile BK_HostExecutable_forProfile(BK_HostExecutable self,
bk_string application, bk_string profile);

// Creates a temporary profile that gets automatically removed after use.
BK_Profile BK_HostExecutable_createTemporaryProfile(BK_HostExecutable self);

#ifdef __cplusplus
}
#endif

#endif // BERKELIUM_API_H_
****************************************************************
Reply all
Reply to author
Forward
0 new messages