Commit a2bf251f authored by Maxime Perrotin's avatar Maxime Perrotin

Generate gpr files properly

parent fb0d4ab2
......@@ -1951,11 +1951,19 @@ class SDL_View(QtGui.QGraphicsView, object):
prj_name = ''.join(
filename.split(os.path.extsep)[0:-1]).split(os.path.sep)[-1]
# Neet to get the list of .pr (incl e.g. system_structure.pr)
# for the gpr file
pr_names = ['"' + os.path.basename(pr_file) + '"'
for pr_file in sdlSymbols.AST.pr_files]
first_pr = pr_names.pop()
other_pr = ", ".join(pr_names)
template_gpr_sdl = '''with "dataview_ada";
project {pr} is
for Languages use ("SDL");
for Source_Dirs use (".");
for Object_Dir use "code";
for Source_Files use ({first_pr});
package Naming is
for Body_Suffix ("SDL") use ".pr";
......@@ -1964,9 +1972,11 @@ project {pr} is
package Compiler is
for Driver ("SDL") use "opengeode";
for Object_File_Suffix ("SDL") use ".adb";
for Leading_Required_Switches ("SDL") use ("--toAda");
for Leading_Required_Switches ("SDL") use ("--toAda"{other_pr});
end Compiler;
end {pr};'''.format(pr=prj_name)
end {pr};'''.format(pr=prj_name,
first_pr=first_pr,
other_pr=", " + other_pr if other_pr else "")
# ASN1 template to be filled with "Ada" or "c"
template_gpr_asn1 = '''project DataView_{lang} is
......
--
-- Copyright (c) 2015 European Space Agency
-- All Rights Reserved
--
-- Project: SOIS Electronic Data Sheets
--
-- Module: CCSDS_SOIS_Subnetwork.asn
--
-- Author: SOIS EDS Tooling (internal unreleased version)
--
--
CcsdsSoisSubnetwork DEFINITIONS AUTOMATIC TAGS ::= BEGIN
-- imports
-- explicit namespace-level data type declarations
OctetTypeT ::= INTEGER (0..255)
MemoryIDTypeT ::= INTEGER (0..65535)
StartStopT ::= ENUMERATED
{
start(0),
stop(1)
}
MemoryAddressTypeT ::= INTEGER (0..4294967296)
-- explicit component-level data type declarations
END
--
-- Copyright (c) 2015 European Space Agency
-- All Rights Reserved
--
-- Project: SOIS Electronic Data Sheets
--
-- Module: CCSDS_SOIS_Subnetwork_interfaces.asn
--
-- Author: SOIS EDS Tooling (internal unreleased version)
--
--
CcsdsSoisSubnetworkInterfaces DEFINITIONS AUTOMATIC TAGS ::= BEGIN
-- imports
IMPORTS
ExtendedStatusModeEnumTypeT,ExtendedStatusOrModeTypeT,OpCountTypeT,QueryCountTypeT,
ReadStatusModeCommandTypeT,StatusFlag1TypeT,StatusFlag2TypeT,StatusTypeT,TelecommandTypeT,
TelecommandTypeEnumTypeT,TelemetryTypeT,TelemetryTypeEnumTypeT FROM Demo
MemoryAddressTypeT,MemoryIDTypeT FROM CcsdsSoisSubnetwork
;
-- interface messages
-- message types for DemoDeviceDSAPSubnetworkmas
MASInterfaceTypeDownType ::= CHOICE
{
sendCommand CHOICE {
readExtendedstatusormodetype SEQUENCE {
},
readStatustype SEQUENCE {
},
unacknowledgedWrite SEQUENCE {
memoryID MemoryIDTypeT (0..0),
memoryAddress MemoryAddressTypeT (100..100),
data-value ReadStatusModeCommandTypeT
},
write SEQUENCE {
memoryID MemoryIDTypeT (0..0),
memoryAddress MemoryAddressTypeT (100..100),
data-value ReadStatusModeCommandTypeT
}
}
}
MASInterfaceTypeUpType ::= CHOICE
{
replyToCommand CHOICE {
readExtendedstatusormodetype SEQUENCE {
data-value ExtendedStatusOrModeTypeT
},
readStatustype SEQUENCE {
data-value StatusTypeT
},
write SEQUENCE {
}
}
}
MASInterfaceTypeProviderType ::= SEQUENCE
{
inputReady BOOLEAN,
inputData MASInterfaceTypeDownType,
outputData MASInterfaceTypeUpType
}
MASInterfaceTypeClientType ::= SEQUENCE
{
inputReady BOOLEAN,
inputData MASInterfaceTypeUpType,
outputData MASInterfaceTypeDownType
}
-- message types for DemoDeviceDSAPSubnetworkps
PSInterfaceTypeDownType ::= CHOICE
{
sendCommand CHOICE {
send SEQUENCE {
data-value TelecommandTypeT
}
}
}
PSInterfaceTypeUpType ::= CHOICE
{
replyToCommand CHOICE {
receive SEQUENCE {
data-value TelemetryTypeT
}
}
}
PSInterfaceTypeProviderType ::= SEQUENCE
{
inputReady BOOLEAN,
inputData PSInterfaceTypeDownType,
outputData PSInterfaceTypeUpType
}
PSInterfaceTypeClientType ::= SEQUENCE
{
inputReady BOOLEAN,
inputData PSInterfaceTypeUpType,
outputData PSInterfaceTypeDownType
}
END
--
-- Copyright (c) 2015 European Space Agency
-- All Rights Reserved
--
-- Project: SOIS Electronic Data Sheets
--
-- Module: Demo.asn
--
-- Author: SOIS EDS Tooling (internal unreleased version)
--
--
Demo DEFINITIONS AUTOMATIC TAGS ::= BEGIN
-- imports
IMPORTS
OctetTypeT,MemoryAddressTypeT,MemoryIDTypeT FROM CcsdsSoisSubnetwork
;
-- explicit namespace-level data type declarations
StatusFlag1TypeT ::= BOOLEAN
StatusFlag2TypeT ::= BOOLEAN
CalibratedHKTypeT ::= REAL (-3.4028234663852886E+38..3.4028234663852886E+38)
QueryCountTypeT ::= INTEGER (0..255)
ExtendedModeTypeT ::= INTEGER (0..255)
ExtendedStatusTypeT ::= INTEGER (0..255)
HKTypeT ::= INTEGER (0..255)
CommandStatusTypeT ::= INTEGER (0..65535)
EventDataTypeT ::= INTEGER (0..255)
UserDataLengthTypeT ::= INTEGER (0..65535)
ModeTypeT ::= ENUMERATED
{
reset(0),
doALittleBitOfStuff(1),
doLotsOfStuff(4),
doTonnesOfStuffBadly(6),
revealABugAndMalfunction(9)
}
EventTypeTypeT ::= ENUMERATED
{
event1(0),
event2(1),
event3(2)
}
ReadStatusModeCommandTypeT ::= ENUMERATED
{
readStatus(1),
readMode(2)
}
ExtendedStatusModeEnumTypeT ::= ENUMERATED
{
mode(0),
status(1)
}
TelecommandTypeEnumTypeT ::= ENUMERATED
{
mode(0),
userData(1)
}
TelemetryTypeEnumTypeT ::= ENUMERATED
{
ack(0),
type1(1),
type2(2),
event(3)
}
OpCountTypeT ::= INTEGER (0..39)
StatusTypeT ::=
SEQUENCE
{
statusFlag1 StatusFlag1TypeT,
statusFlag2 StatusFlag2TypeT,
opCount OpCountTypeT
}
TelemetrySet1TypeT ::=
SEQUENCE
{
hk1 HKTypeT,
hk2 HKTypeT
}
TelemetrySet2TypeT ::=
SEQUENCE
{
hk3 HKTypeT,
hk4 HKTypeT
}
EventTypeT ::=
SEQUENCE
{
typeKeyword EventTypeTypeT,
data-value EventDataTypeT
}
ExtendedStatusOrModeTypeT ::=
SEQUENCE
{
queryCount QueryCountTypeT,
body-choice CHOICE {
mode ExtendedModeUnionTypeBodyT,
status ExtendedStatusUnionTypeBodyT
}
}
ExtendedModeUnionTypeBodyT ::= SEQUENCE
{
mode ExtendedModeTypeT
}
ExtendedStatusUnionTypeBodyT ::= SEQUENCE
{
status ExtendedStatusTypeT
}
ExtendedStatusUnionTypeT ::=
SEQUENCE
{
queryCount QueryCountTypeT,
typeKeyword ExtendedStatusModeEnumTypeT,
status ExtendedStatusTypeT
}
ExtendedModeUnionTypeT ::=
SEQUENCE
{
queryCount QueryCountTypeT,
typeKeyword ExtendedStatusModeEnumTypeT,
mode ExtendedModeTypeT
}
TelecommandTypeT ::=
SEQUENCE
{
body-choice CHOICE {
mode TelecommandModeTypeBodyT,
userData TelecommandUserDataTypeBodyT
}
}
TelecommandModeTypeBodyT ::= SEQUENCE
{
mode ModeTypeT
}
TelecommandUserDataTypeBodyT ::= SEQUENCE
{
userData SEQUENCE SIZE(0..255) OF OctetTypeT
}
TelecommandModeTypeT ::=
SEQUENCE
{
typeKeyword TelecommandTypeEnumTypeT,
mode ModeTypeT
}
TelecommandUserDataTypeT ::=
SEQUENCE
{
typeKeyword TelecommandTypeEnumTypeT,
userData SEQUENCE SIZE(0..255) OF OctetTypeT
}
TelemetryTypeT ::=
SEQUENCE
{
body-choice CHOICE {
ack TelemetryAckTypeBodyT,
type1 Telemetry1TypeBodyT,
type2 Telemetry2TypeBodyT,
event TelemetryEventTypeBodyT
}
}
Telemetry1TypeBodyT ::= SEQUENCE
{
telemetrySet TelemetrySet1TypeT
}
Telemetry2TypeBodyT ::= SEQUENCE
{
telemetrySet TelemetrySet2TypeT
}
TelemetryAckTypeBodyT ::= SEQUENCE
{
status CommandStatusTypeT
}
TelemetryEventTypeBodyT ::= SEQUENCE
{
eventType EventTypeTypeT,
eventData EventDataTypeT
}
TelemetryAckTypeT ::=
SEQUENCE
{
typeKeyword TelemetryTypeEnumTypeT,
status CommandStatusTypeT
}
Telemetry1TypeT ::=
SEQUENCE
{
typeKeyword TelemetryTypeEnumTypeT,
telemetrySet TelemetrySet1TypeT
}
Telemetry2TypeT ::=
SEQUENCE
{
typeKeyword TelemetryTypeEnumTypeT,
telemetrySet TelemetrySet2TypeT
}
TelemetryEventTypeT ::=
SEQUENCE
{
typeKeyword TelemetryTypeEnumTypeT,
eventType EventTypeTypeT,
eventData EventDataTypeT
}
-- explicit component-level data type declarations
-- types local to DemoDeviceDACP
-- types local to DemoDeviceDSAP
END
--
-- Copyright (c) 2015 European Space Agency
-- All Rights Reserved
--
-- Project: SOIS Electronic Data Sheets
--
-- Module: Demo_interfaces.asn
--
-- Author: SOIS EDS Tooling (internal unreleased version)
--
--
DemoInterfaces DEFINITIONS AUTOMATIC TAGS ::= BEGIN
-- imports
IMPORTS
CommandStatusTypeT,EventDataTypeT,EventTypeT,EventTypeTypeT,ExtendedModeTypeT,
ExtendedStatusTypeT,HKTypeT,ModeTypeT,OpCountTypeT,QueryCountTypeT,StatusFlag1TypeT,
StatusFlag2TypeT,StatusTypeT,TelemetrySet1TypeT,TelemetrySet2TypeT,CalibratedHKTypeT FROM Demo
OctetTypeT FROM CcsdsSoisSubnetwork
;
-- interface messages
-- message types for DeviceInterface
DeviceAccessInterfaceDownType ::= CHOICE
{
getParameter CHOICE {
extendedMode INTEGER(0),
extendedStatus INTEGER(0),
queryCount INTEGER(0),
status INTEGER(0)
},
sendCommand CHOICE {
setMode SEQUENCE {
mode ModeTypeT
},
setUserData SEQUENCE {
data-value OctetTypeT
}
}
}
DeviceAccessInterfaceUpType ::= CHOICE
{
updateParameter CHOICE {
deviceEvent EventTypeT,
extendedMode ExtendedModeTypeT,
extendedStatus ExtendedStatusTypeT,
queryCount QueryCountTypeT,
status StatusTypeT,
telemetrySet1 TelemetrySet1TypeT,
telemetrySet2 TelemetrySet2TypeT
},
replyToCommand CHOICE {
setMode SEQUENCE {
status CommandStatusTypeT
},
setUserData SEQUENCE {
status CommandStatusTypeT
}
}
}
DeviceAccessInterfaceProviderType ::= SEQUENCE
{
inputReady BOOLEAN,
inputData DeviceAccessInterfaceDownType,
outputData DeviceAccessInterfaceUpType
}
DeviceAccessInterfaceClientType ::= SEQUENCE
{
inputReady BOOLEAN,
inputData DeviceAccessInterfaceUpType,
outputData DeviceAccessInterfaceDownType
}
-- message types for DemoDeviceDACPVirtualinterface
DeviceFunctionalInterfaceUpType ::= CHOICE
{
updateParameter CHOICE {
hk1 CalibratedHKTypeT,
hk2 CalibratedHKTypeT
}
}
DeviceFunctionalInterfaceProviderType ::= SEQUENCE
{
outputData DeviceFunctionalInterfaceUpType
}
DeviceFunctionalInterfaceClientType ::= SEQUENCE
{
inputReady BOOLEAN,
inputData DeviceFunctionalInterfaceUpType
}
END
--
-- Copyright (c) 2015 European Space Agency
-- All Rights Reserved
--
-- Project: SOIS Electronic Data Sheets
--
-- Module: Environment.asn
--
-- Author: SOIS EDS Tooling (internal unreleased version)
--
--
Environment DEFINITIONS AUTOMATIC TAGS ::= BEGIN
-- imports
T-N1 ::= BOOLEAN
-- explicit namespace-level data type declarations
-- explicit component-level data type declarations
-- types local to Application
END
--
-- Copyright (c) 2015 European Space Agency
-- All Rights Reserved
--
-- Project: SOIS Electronic Data Sheets
--
-- Module: Environment_interfaces.asn
--
-- Author: SOIS EDS Tooling (internal unreleased version)
--
--
EnvironmentInterfaces DEFINITIONS AUTOMATIC TAGS ::= BEGIN
-- imports
IMPORTS
;
T-N2 ::= BOOLEAN
-- interface messages
END
--
-- Copyright (c) 2015 European Space Agency
-- All Rights Reserved
--
-- Project: SOIS Electronic Data Sheets
--
-- Module: CCSDS_SOIS_Subnetwork.asn