|
GMW3110
© Copyright 2010 General Motors All Rights Reserved
February 2010
Page 13 of 336
SymbolBog'liq gmw3110
GMW3110
© Copyright 2010 General Motors All Rights Reserved
February 2010
Page 13 of 336
Symbol
Definition
<<
Logical bit-wise shift left
$
Prefix for Hexadecimal Number
b
Suffix for Binary Number
/*
Prefix for a Comment String
*/
Suffix for comment string of more than one line
3.6.2 Pseudo Code Definition.
The ECU Interface functions are presented in pseudo code format. This is to
reduce the possibility of multiple interpretations of a diagnostic service (test mode). The indentation practices
in the example functions below shall be followed to enhance readability.
3.6.2.1 Pseudo Code Syntax.
3.6.2.1.1 Decision Statement.
Decision statements use the keywords IF, THEN, ELSE, ELSE IF and ENDIF
to control the flow of execution. Included in the parenthesis is a relational expression which can be evaluated
as either TRUE or FALSE. The flow of execution through decision statements is based on the results of the
evaluation of the relational expression(s) contained within them. An example is provided below:
IF (relational expression #1) THEN
body when expression #1 is TRUE
ELSE IF (relational expression #2) THEN
body when expression #2 is TRUE
ELSE
body when expressions #1 and #2 are FALSE
ENDIF
Note:
Every IF statement shall have a corresponding ELSE, ELSE IF, or ENDIF statement. Below is an
example of pseudo code which uses two variables x and y.
IF (x > y) THEN x = x+2 /* body when x > y */
ELSE IF (x = y) THEN
IF (x!= 0)
/* body when x = y */
x = y/x
/* body when x = y and also body when x!= 0 */
ENDIF
/* body when x = y */
ELSE
x = x*y
/* body when x < y */
ENDIF
3.6.2.1.2 Select Statement.
Select statements are useful when a different body of code is to execute based
on a series of relational expressions. The select statement uses the keywords SELECT FIRST and
ENDSELECT to mark the beginning and ending of the select statement. When this statement is encountered,
the relational expression in parenthesis next to the first WHEN keyword is evaluated. If this relational
expression evaluates TRUE, then the body after the first WHEN keyword is executed. The body portion is
indented one level and ends at the last line before the next WHEN keyword. If the first relational expression
evaluates FALSE, the relational expression after the next WHEN keyword is evaluated. If this relational
expression evaluates TRUE, then the body associated with that WHEN keyword is executed. If none of the
relational expressions following WHEN keywords evaluate to TRUE, then the body following the OTHERWISE
keyword is executed. After executing the body section of code following any WHEN or OTHERWISE keyword,
the select statement is exited and the code begins executing after the ENDSELECT keyword. An example of
this type of statement is included below:
SELECT FIRST
WHEN (first relational expression)
body when first expression is TRUE
WHEN (second relational expression)
CameraLoops.com
Do'stlaringiz bilan baham: |
|
|