Browse Prior Art Database

Automatic If/Then/Else Splitting for Star Charter

IP.com Disclosure Number: IPCOM000102634D
Original Publication Date: 1990-Dec-01
Included in the Prior Art Database: 2005-Mar-17
Document File: 5 page(s) / 116K

IBM

Related People

Crago, SP: AUTHOR [+2]

Abstract

Disclosed is a method for Star Charter to generate Nassi-Scheiderman charts with automatic if/then/else splits without any programmer intervention. Complete compatibility is maintained with previous Star Charter.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Automatic If/Then/Else Splitting for Star Charter

Disclosed is a method for Star Charter to generate
Nassi-Scheiderman charts with automatic if/then/else splits without
any programmer intervention.  Complete compatibility is maintained
with previous Star Charter.

The following example shows a segment of C code, its star chart
without automatic if/then/else splitting, and its star chart with
automatic if/then/else splitting.
Code:
if (cond1) {
if (cond2) {
statement1;
}
else
statement2;
}
else
statement3;

See Fig. 1 for a Star Chart without automatic splitting, and
Fig.  2 for a Star Chart with automatic splitting.

An algorithm developed calculates the split for an if/then/else
statement based on the statements and control structures within the
if/then/else statement.  The algorithm can be bypassed in a
star-charter program if the programmer chooses to provide the splits.
This maintains compatibility with old code where the splits have

The automatic if/then/else splitting algorithm is a recursive
algorithm which assigns a weight to each leg of an if/then/else
statement.  The algorithm assigns a weight to a leg based on the
control structures within the leg.  Then, the percentages of the
split are calculated from the weights.  For example, if a THEN leg
has a weight of 7 and an ELSE leg has a weight of 3, then
the THEN leg would get 70 percent (7/[7+3]) of the chart and the ELSE
leg would get 30 percent (3/[7+3]).

The flow chart in Fig. 3 shows how the algorithm works. Assume
that CurrentWeight() is a function that returns the weight of the
next statement in the code.  CurrentWeight() considers each control
structure to be one compound statement.  For example, an if/then/else
statement that contains several other control structures (including
more if/then/else statements) is considered to be one statement. The
variable Split is the percentage that the THEN leg will be allotted
of the total space for the if/then/else statement.