[ Pobierz całość w formacie PDF ]
.38.49BufferPointerTemporaryCommonIndividualPlex-C 1DECLARE;!GLOBAL SYMBOLS!!LOCAL SYMBOLS!!RECORDS!!COMMON AND STORED VARIABLES!!TEMPORARY VARIABLES!!STRUCTURES!END DECLARE;Figure 3.38The order of variables and constants in the declare sector.Note that, according to this order, structured variables are declared in the section"COMMON AND STORED VARIABLES".The definition of their structures,though, is usually several pages further down in the section "STRUCTURES" inthe declare sector!Declare buffer variables not part of a record in the section COMMON ANDSTORED VARIABLES.Please note that Chapter 9, Buffers and Structures, and Chapter 10, AXE Parameters, discuss additional data types.ReferencesSoftware Reliability Handbook,EN/LZG 205 603,© Ericsson Telecom AB 1998Updating of Software Units with R Variables,ETX 102 60 - 1060 Uen,© Ericsson Telecom AB 1993Note: This document contains an extensive list of limitations for using R variables.Implementing Greater Than 64 K Files in AXE,ETX 102 60 - 1061 Uen,© Ericsson Telecom AB, 199350Chapter 4 Program SectorIntroductionThe previous chapter introduced the declare sector.This chapter explains some ofthe statements used in the program sector and some programming concepts.Chapter ObjectivesAfter completing this chapter and the exercises you are able to:" translate a basic flow chart into a Plex-C program" write Plex-C statements for:- variable assignments- jumps- selections- iterationsFigure 4.1Chapter ObjectivesProgramming ConceptsThis section discusses program structures, operators and the concept of a fieldexpression.Program StructuresThere are three basic structural elements needed to execute computer programs." sequence" selection" iterationA sequence, shown in Figure 4.2, is one or more statements that follow eachother.51Plex-C 1STATEMENTSTATEMENTSTATEMENTFigure 4.2Flow chart for a sequenceA selection is a choice between several options.Figure 4.3 illustrates the following choice: If the condition A = YES is true, the CP executes statement 1, but if A= NO is true, the CP executes statement 2.AYES NOSTATEMENT 1 STATEMENT 2Figure 4.3Flow chart for a selectionFigure 4.4 shows a flow chart for an iteration scanning the file ROUTEDATA.Foreach record individual, the iteration sets the symbol variable STATE to IDLE andthe field variable ADMSTATE equal to local number symbol ZCONNECTED.The iteration affects all records in the file.The number of loops depends on thenumber of records in file ROUTEDATA.52Program SectorSCAN FILEROUTEDATASET STATE=IDLESET ADMSTATE=ZCONNECTEDSCAN FILEROUTEDATAFigure 4.4Flow chart for a FOR loop iterationArithmetic OperatorsPlex-C uses only four different arithmetic operators.+ Addition Subtraction/ Division* MultiplicationThe processor works with non-negative integers only and truncates post-commadigits.Division by zero is illegal and may generate a restart of the exchange.Please avoid value overflows, although they do not cause a run-time error.Alsonote that numerals can be specified in decimal and hexadecimal notation.Hexadecimal numbers are preceded by a hash # (e.g.#FF = 255).Super-variables are field variables with a fixed size of 32 bits or more.It is notpossible to apply the arithmetic operators on super-variables, since they don t fitinto the arithmetic registers.However, the operators may be used for R variables,the lengths of which depends on the register size of the target processor.Logic OperatorsPlex-C offers a range of six different logic operators.53Plex-C 1( ) NOT invert variable bit-by-bit=> SHIFT RIGHT non-circular shift to the right by n bitsCME20TCSC:CONFUSIONTOUT THENDO RELEASECALL;FI;! BEGIN OF OPTIONAL USER CODES !EXAMVERIFYCODE) ! PLACE HERE !! VERIFICATION CODE TO BE EXECUTED!GOTO RETVERIFYLAB1;EXAMROLLBACK) ! PLACE HERE !! ROLLBACK-CODE TO BE EXECUTED !GOTO RETROLLBACKLAB2;EXAMPOSTUPDATE) ! PLACE HERE !! POSTUPDATE-CODE TO BE EXECUTED !GOTO RETPOSTUPDATELB3;EXAMUPDATE) ! PLACE HERE !! UPDATE-CODE TO BE EXECUTED !GOTO RETUPDATELB4;BEGIN RELEASECALL; ! STATEMENT BLOCK !END RELEASECALL;END PROGRAM;Figure 10.9Typical program sector with user codesParameter AccessThe following syntax is available for expressions in the program sector; see Figure 10.10.Thus, programs can access parameter values and other parameterinformation.The set name is only optional, if the parameter name is unique among all namesin the SPI.The optional attribute states the type of parameter information retrieved.If omitted, VALUE is assumed.230AXE ParametersPROGRAM; PLEX;set-name : parameter-name.attribute ;VALUESETNAMEPARAMETERNAMERELATIONUNITCLASSDISTRIBUTIONFigure 10.10Syntax for accessing AXE ParametersApplication Parameter DistributionThe following procedure is only available for AXE Parameters of distributiontype APPLICATION; see Figure 10.11.The statement allows Parameter Ownersto broadcast the new parameter value to all Parameter Users.Only Parameter Owners may use the Plex-C procedure DISTRIBUTE.This procedure destroys all temporary variables with the exception of the pointerin the optional POINTER IS clause.After the execution, the optional CODE ISclause has returned an APZ status code in the user status variable.See reference [2] for further information [ Pobierz caÅ‚ość w formacie PDF ]