From f5442bde55872d703f184f8617329f706bad8149 Mon Sep 17 00:00:00 2001 From: Necip Fazil Yildiran Date: Mon, 10 Aug 2020 14:43:38 +0000 Subject: pkg, prog: add per-field direction attribute --- docs/syscall_descriptions_syntax.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'docs/syscall_descriptions_syntax.md') diff --git a/docs/syscall_descriptions_syntax.md b/docs/syscall_descriptions_syntax.md index 7f4033079..5af302de8 100644 --- a/docs/syscall_descriptions_syntax.md +++ b/docs/syscall_descriptions_syntax.md @@ -120,10 +120,14 @@ Structs are described as: ``` structname "{" "\n" - (fieldname type "\n")+ + (fieldname type ("(" fieldattribute* ")")? "\n")+ "}" ("[" attribute* "]")? ``` +Fields can have attributes specified in parentheses after the field, independent +of their type. The only attribute is direction (`in/out/inout`). For the field for +which it is specified, the direction attributes on the upper levels are overridden. + Structs can have attributes specified in square brackets after the struct. Attributes are: @@ -137,10 +141,12 @@ Unions are described as: ``` unionname "[" "\n" - (fieldname type "\n")+ + (fieldname type ("(" fieldattribute* ")")? "\n")+ "]" ("[" attribute* "]")? ``` +Field attributes are as defined for [structs](#structs). + Unions can have attributes specified in square brackets after the union. Attributes are: @@ -181,6 +187,22 @@ test_struct { } ``` +For more complex producer/consumer scenarios, field attributes can be utilized. +For example: + +``` +resource my_resource_1[int32] +resource my_resource_2[int32] + +request_produce1_consume2(..., arg ptr[inout, test_struct]) + +test_struct { + ... + field0 my_resource_1 (out) + field1 my_resource_2 (in) +} +``` + ## Type Aliases Complex types that are often repeated can be given short type aliases using the -- cgit mrf-deployment