esa / opengeode

OpenGEODE - a free SDL editor
https://opengeode.net
GNU Lesser General Public License v3.0
69 stars 20 forks source link

Another Question about ASN.1 #46

Closed zongz1024 closed 5 years ago

zongz1024 commented 5 years ago

Sorry to bother you again ! I want to use asn.1 syntax to represent character types. but it is not given directly on the website which you gave to me. So I get this way by myself after reading something from the web which you gave to me.But I do not know whether it is right.

char ::= PrintableString (FROM ("a".."z")|FROM ("A".."Z"))

But this way only can represent the char of letter , How can I represent all the char??? Thank you for your lots of help.

maxime-esa commented 5 years ago

What do you mean exactly by "all the char"?

maxime-esa commented 5 years ago

Perhaps you mean the characters from international alphabet 5 - see the complete set of characters here: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/nls/rbagscharset01169.htm

In that case I suggest you use the IA5String built-in ASN.1 type, instead of PrintableString (which is not supported in Opengeode)

zongz1024 commented 5 years ago

Perhaps you mean the characters from international alphabet 5 - see the complete set of characters here: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/nls/rbagscharset01169.htm

In that case I suggest you use the IA5String built-in ASN.1 type, instead of PrintableString (which is not supported in Opengeode)

If I want to represent the complete set of characters,do I need to list all character ranges? like this:

char ::= PrintableString (FROM ("a".."z")|FROM ("A".."Z")|FROM("0".."9")|FROM("+".."?"))

to represent them
image

maxime-esa commented 5 years ago

As I said, you just need to use the IA5String type instead of PrintableString. It contains this character set already.

zongz1024 commented 5 years ago

As I said, you just need to use the IA5String type instead of PrintableString. It contains this character set already.

like this???

char ::=IA5String;

a char::="a";
maxime-esa commented 5 years ago

No, like this:

  1. First you subtype IA5String to give it size limits:
    MyString ::= IA5String (SIZE (0..100))
  1. Then if needed you can define constants of this type:

    a MyString ::= "Hello, world"
  2. If you want to use it in the SDL model:

    dcl a MyString := 'Hello, world';
zongz1024 commented 5 years ago

No, like this:

  1. First you subtype IA5String to give it size limits:
    MyString ::= IA5String (SIZE (0..100))
  1. Then if needed you can define constants of this type:
    a MyString ::= "Hello, world"
  1. If you want to use it in the SDL model:
    dcl a MyString := "Hello, world";

I do not want to represent a String.I just want to represent character type. Like this. Is it right?

Char ::= IA5String (SIZE (0..1))

 dcl a MyChar := "H";
maxime-esa commented 5 years ago

If it is one char you can use (SIZE (1)) And then dcl a MyChar := 'h'; (use single quotes for strings in SDL, not double quote - sorry I made the mistake in my previous answer)

zongz1024 commented 5 years ago

If it is one char you can use (SIZE (1)) And then dcl a MyChar := 'h'; (use single quotes for strings in SDL, not double quote - sorry I made the mistake in my previous answer)

OK,Thanks for your help again.

maxime-esa commented 5 years ago

You're welcome.