Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000414Taste[All Projects] ASN.1 Compilerpublic2015-01-26 09:362024-03-20 13:22
Reporterttsiodras 
Assigned Tomaxime 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Summary0000414:

Add _IsConstraintValid functions to the Python backend output

Description

In the Python backend, generate functions with suffix “_IsConstraintValid”
that are aligned with the C and Ada backends ; the format of the argument of
the function has to be agreed with ESA.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0002564)
ttsiodras (administrator)
2016-01-27 13:20

Implemented in r7677.

Types now contain a member that returns a tuple - (isValid, errorCode).
Example use:

#!/usr/bin/env python2
#
# With this sample.asn:
#
# MY-MODULE DEFINITIONS AUTOMATIC TAGS ::= BEGIN
# 
# Nested ::= SEQUENCE {
#     somethingElse INTEGER(0..100)
# }
# 
# END

from sample_asn import *
msg = Nested()
msg.somethingElse.Set(100)
isValid, _ = msg.IsConstraintValid()
assert isValid is True
msg.somethingElse.Set(500)
isValid, err = msg.IsConstraintValid()
assert isValid is False
# Names of errors come from sample.h
assert err == DV.ERR_Nested_somethingElse
(0002565)
maxime (administrator)
2016-01-27 18:04

Thanks for implementing this function into Stubs.py

However I had something else in mind with this ticket. Using Stubs,py means having gone through C -> Swig -> Compilation -> import

My need is to have native IsConstraintValid functions in Python for allowing live checks of ASN.1 variables in Python in Opengeode.

So that if the user has such a type:

X ::= INTEGER (10 | 20)  -- allowing only value 10 or 20

And the user tries to assign a value such as :

TASK hello := 5;   -- hello of type X

the semantic checker should be able to figure out that there is a range error.

At the moment the generic stg backend (used for xml.stg and python.stg) only reports min and max ranges ; the idea is to get the complete algorithm for checking the constraints from python. This involves modification of asn1scc to feed the python STG backend with the same information as the C/Ada backends.

So: not a simple task.

(0002566)
ttsiodras (administrator)
2016-01-28 14:52

I see - so if I understand you correctly, this is about the compiler's "generic-STG" related AST, not DMT stuff.

Shouldn't this be assigned to George, then?

(0003826)
maxime (administrator)
2024-03-20 13:22

Closing - will be addressed when a native Python backend for asn1scc is made available


- Issue History
Date Modified Username Field Change
2015-01-26 09:36 ttsiodras New Issue
2015-01-26 09:36 ttsiodras Status

new => assigned

2015-01-26 09:36 ttsiodras Assigned To

=> ttsiodras

2015-04-16 08:26 user28 Assigned To

ttsiodras => user28

2015-06-24 16:12 gmamais Assigned To

user28 => gmamais

2015-06-25 07:37 maxime Assigned To

gmamais => maxime

2016-01-27 13:20 ttsiodras Note Added: 0002564
2016-01-27 13:38 ttsiodras Status

assigned => resolved

2016-01-27 13:38 ttsiodras Resolution

open => fixed

2016-01-27 18:04 maxime Note Added: 0002565
2016-01-27 18:04 maxime Status

resolved => new

2016-01-28 14:52 ttsiodras Note Added: 0002566
2024-03-20 13:22 maxime Note Added: 0003826
2024-03-20 13:22 maxime Status

new => closed



Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker