PengZheng commented on code in PR #690:
URL: https://github.com/apache/celix/pull/690#discussion_r1408606584


##########
libs/dfi/README.md:
##########
@@ -19,4 +19,243 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 -->
 
-# Apache Celix Dynamic Function Interface
+## Apache Celix Dynamic Function Interface
+
+Dynamic Function Interface (DFI) is a dynamic interface type implementation 
based on [libffi](https://en.wikipedia.org/wiki/Libffi).
+It can generate dynamic interface types according to the interface description 
file, and can convert the corresponding 
+dynamic interface call into a [JSON 
representation](https://amdatu.atlassian.net/wiki/spaces/AMDATUDEV/pages/21954571/Amdatu+Remote#AmdatuRemote-AdminHTTP%2FJson).
 It can also convert the JSON representation into a dynamic interface call.
+
+### Conan Option
+    build_celix_dfi=True   Default is False
+
+### CMake Option
+    CELIX_DFI=ON           Default is ON
+
+### Interface Descriptor
+
+In `libdfi`, we have defined a set of simple interface description languages. 
Users can use this language to describe interface types, and at runtime, libdfi 
converts the interface description into a dynamic interface.
+
+Before introducing the interface description language, let's look at an 
example of interface description.
+
+~~~
+:header
+type=interface
+name=calculator
+version=1.0.0
+:annotations
+classname=org.example.Calculator
+:types
+StatsResult={DDD[D average min max input}
+:methods
+add(DD)D=add(#am=handle;PDD#am=pre;*D)N
+~~~
+
+As above, the interface description has four sections: the header section, 
annotations section, types section, and methods section. The format of each 
section is as follows:
+
+~~~
+ ':header\n' 'Name=Value\n'...
+ ':annotations\n' 'Name=Value\n'...
+ ':types\n' 'TypeId=Value\n'...
+ ':methods\n' 'MethodId=Value\n'...
+~~~
+
+Among them, the legal characters that can be used in the “name” and “TypeId” 
include [a-zA-Z0-9_], the legal characters in “MethodId” include [a-zA-Z0-9_] 
and ".();[{}/". Besides [a-zA-Z0-9], the legal characters in “value” also 
include ".<>{}[]?;:~!@#$%^&*()_+-=,./'". It's worth noting that there should 
not be spaces on either side of '=', and each statement must end with a 
newline(‘\n’).
+
+For the interface description, its header section must include three elements: 
type, name, version. The value of "type" should be "interface", "name" is the 
interface name (service name), the value of "version" should coincide with the 
version number in the actually used interface header file, and it should 
conform to [semantic versioning requirements](https://semver.org/).
+
+#### The Data Types In The Interface Descriptor
+
+The data types supported by the interface description include:
+
+- **Simple Types**
+
+  *Type schema*:
+  
+  |**Identifier**|B  |D     |F    |I      |J      |S      |V   |Z             
|b    | i      | j      | s      |P     |t     |N  | 
+  
|---------|---|------|-----|-------|-------|-------|----|--------------|-----|--------|--------|--------|------|------|---|
+  
|**Types**|char|double|float|int32_t|int64_t|int16_t|void|boolean(uint8)|uchar|uint32_t|uint64_t|uint16_t|void
 *|char *|int|

Review Comment:
   Maybe we still need `char *` for plain `char *` and `t` for null-terminate c 
string.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to