noft Manual (G06.27+, H06.03+, J06.03+)

Sample nld and noft Session
noft Manual528273-003
A-2
Source Module MAINC
Source Module MAINC
Source module MAINC has the main function. The main function calls the
initialize function to allocate the bus stop array and to set a random number of
passengers in each cell of the array. The main function then loops, incrementing a
counter until the counter is greater than the number of bus stops. For each iteration
(bus stop), main calls the delete_passengers and add_passengers functions. At
the completion of the loop, main calls the wrap-up function, which displays the
number of people on the bus and the number of people left at each bus stop.
Example A-1. Header File GLOBALSH With Edit Line Numbers
0
.001 #define BUS_STOP_CAPACITY 50
.002 #define BUS_CAPACITY 44
.003 #define MAXSTOPS 5
.004
.01
.1
1 extern long *bus_stop_array;
2 extern long passengers_on_bus;
Example A-2. Header File MODULE1H With Edit Line Numbers
0
1
2
5 void initialize(long);
6 void wrapup(long);
Example A-3. Header File MODULE2H With Edit Line Numbers
1
2
3 void add_passengers(long);
4 void delete_passengers(long);
Example A-4. Header File UTILH With Edit Line Number
1 void seed_random_number(void);