From aa4e27ebac9eb287069fab859fe5dcdab82c75bf Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Thu, 12 Jan 2012 15:42:21 +0100 Subject: [asn1] Make tables and processes unnamed - Refactor and clean up asn1_db process - Remove unused stop function in asn1ct.erl - Remove infinite loop possibilites in asn1ct_check.erl - test/1,2,3 now run in separate process - Update documentation for new test options --- lib/asn1/doc/src/asn1ct.xml | 94 ++++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 36 deletions(-) (limited to 'lib/asn1/doc/src/asn1ct.xml') diff --git a/lib/asn1/doc/src/asn1ct.xml b/lib/asn1/doc/src/asn1ct.xml index 0b9ec3df7f..3be58cbc8e 100644 --- a/lib/asn1/doc/src/asn1ct.xml +++ b/lib/asn1/doc/src/asn1ct.xml @@ -4,7 +4,7 @@
- 19972011 + 19972012 Ericsson AB. All Rights Reserved. @@ -44,15 +44,15 @@ - compile(Asn1module) -> ok | {error,Reason} - compile(Asn1module , Options) -> ok | {error,Reason} + compile(Asn1module) -> ok | {error, Reason} + compile(Asn1module, Options) -> ok | {error, Reason} Compile an ASN.1 module and generate encode/decode functions according to the encoding rules BER or PER. Asn1module = atom() | string() Options = [Option| OldOption] - Option = ber_bin | per_bin | uper_bin | der | compact_bit_string | - noobj | {n2n,EnumTypeName} |{outdir,Dir} | {i,IncludeDir} | optimize | - nif | asn1config | undec_rest | {inline,OutputName} | inline | + Option = ber_bin | per_bin | uper_bin | der | compact_bit_string | + noobj | {n2n, EnumTypeName} |{outdir, Dir} | {i, IncludeDir} | optimize | + nif | asn1config | undec_rest | {inline, OutputName} | inline | {macro_name_prefix, Prefix} | {record_name_prefix, Prefix} | verbose | warnings_as_errors OldOption = ber | per Reason = term() @@ -158,7 +158,7 @@ File3.asn of the BIT STRING type in Erlang. The notation:

-BitString = {Unused,Binary},
+BitString = {Unused, Binary},
 Unused = integer(),
 Binary = binary()            
 	    
@@ -172,7 +172,7 @@ Binary = binary() .

- {n2n,EnumTypeName} + {n2n, EnumTypeName}

Tells the compiler to generate functions for conversion between @@ -190,17 +190,17 @@ Binary = binary() .erl file. If this option is omitted the generated Erlang module will be compiled.

- {i,IncludeDir} + {i, IncludeDir}

Adds IncludeDir to the search-path for .asn1db and asn1 source files. The compiler tries to open a .asn1db file when a module imports definitions from another ASN.1 module. If no .asn1db file is found the asn1 source file is - parsed. Several {i,IncludeDir} can be given. + parsed. Several {i, IncludeDir} can be given.

- {outdir,Dir} + {outdir, Dir}

Specifies the directory Dir where all generated files shall be placed. If omitted the files are placed in the @@ -251,11 +251,11 @@ Binary = binary() also have some following bytes. Now it is possible to get those following bytes returned together with the decoded value. If an asn1 spec is compiled with this option a tuple - {ok,Value,Rest} is returned. Rest may be a + {ok, Value, Rest} is returned. Rest may be a list or a binary. Earlier versions of the compiler ignored those following bytes.

- {inline,OutputName} + {inline, OutputName}

Compiling with this option gives one output module containing all asn1 run-time functionality. The asn1 specs @@ -267,7 +267,7 @@ Binary = binary() by the igor module of syntax_tools. By default the functions generated from the first asn1 spec in the .set.asn are exported, unless a - {export,[atom()]} or {export_all,true} option + {export, [atom()]} or {export_all, true} option are provided. The list of atoms are names of chosen asn1 specs from the .set.asn file.

When used together with nif for ber_bin, the @@ -278,7 +278,7 @@ Binary = binary() inline

It is also possible to use the sole argument inline. - It is as {inline,OutputName}, but the output file gets the + It is as {inline, OutputName}, but the output file gets the default name of the source .set.asn file.

{macro_name_prefix, Prefix} @@ -322,7 +322,7 @@ Binary = binary()
- encode(Module,Type,Value)-> {ok,Bytes} | {error,Reason} + encode(Module, Type, Value)-> {ok, Bytes} | {error, Reason} Encode an ASN.1 value. Module = Type = atom() @@ -337,13 +337,13 @@ Binary = binary() encode function only performs rudimentary tests that the input Value is a correct instance of Type. The length of strings is for example - not always checked. Returns {ok,Bytes} if successful or - {error,Reason} if an error occurred. + not always checked. Returns {ok, Bytes} if successful or + {error, Reason} if an error occurred.

- decode(Module,Type,Bytes) -> {ok,Value}|{error,Reason} + decode(Module, Type, Bytes) -> {ok, Value} | {error, Reason} Decode from Bytes into an ASN.1 value. Module = Type = atom() @@ -352,11 +352,11 @@ Binary = binary()

Decodes Type from Module from the list of bytes - Bytes. Returns {ok,Value} if successful.

+ Bytes. Returns {ok, Value} if successful.

- value(Module ,Type) -> {ok,Value} | {error,Reason} + value(Module, Type) -> {ok, Value} | {error, Reason} Create an ASN.1 value for test purposes. Module = Type = atom() @@ -371,26 +371,48 @@ Binary = binary() - test(Module) -> ok | {error,Reason} - test(Module,Type) -> ok | {error,Reason} - test(Module,Type,Value) -> ok | {error,Reason} - Perform a test of encode and decode for types in an ASN.1 module. + test(Module) -> ok | {error, Reason} + test(Module, Type | Options) -> ok | {error, Reason} + test(Module, Type, Value | Options) -> ok | {error, Reason} + Perform a test of encode and decode for types in an ASN.1 module. + + Module = Type = atom() + Value = term() + Options = [{i, IncludeDir}] + Reason = term() + -

Performs a test of encode and decode of all types in Module. +

Performs a test of encode and decode of types in Module. The generated functions are called by this function. This function is useful during test to secure that the generated - encode and decode functions and the general runtime support work - as expected.

-test/1 iterates over all types in Module.

-test/2 tests type Type with a random value.

-Type]]> with Value.

+ encode and decode functions and the general runtime support work + as expected.

+ + + +

test/1 iterates over all types in Module.

+
+ +

test/2 tests type Type with a random value.

+
+ +

test/3 tests type Type with Value.

+
+
- Schematically the following happens for each type in the module.

-

+

Schematically the following happens for each type in the module: -{ok,Value} = asn1ct:value(Module,Type), -{ok,Bytes} = asn1ct:encode(Module,Type,Value), -{ok,Value} = asn1ct:decode(Module,Type,Bytes). +{ok, Value} = asn1ct:value(Module, Type), +{ok, Bytes} = asn1ct:encode(Module, Type, Value), +{ok, Value} = asn1ct:decode(Module, Type, Bytes).

+ +

The test functions utilizes the *.asn1db files + for all included modules. If they are located in a different + directory than the current working directory, use the include + option to add paths. This is only needed when automatically + generating values. For static values using Value no + options are needed.

+
-- cgit v1.2.3