1 /****^  ***********************************************************
 2         *                                                         *
 3         * Copyright, (C) Honeywell Bull Inc., 1987                *
 4         *                                                         *
 5         * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 6         *                                                         *
 7         * Copyright (c) 1972 by Massachusetts Institute of        *
 8         * Technology and Honeywell Information Systems, Inc.      *
 9         *                                                         *
10         *********************************************************** */
11 
12 /* format: style4,indattr,ifthenstmt,ifthen,idind35,^indcomtxt */
13 
14 segno_usage: proc;
15 
16 /*
17 
18    Designed and written by R. Bratt, May 31, 1976
19 
20    Last modified:
21    Added increment_other_ring, Keith Loepere, January 22, 1985.
22 
23    This module provides an external interface for incrementing and decrementing
24    segment number usage counts.  This facility allows the creation and resurection
25    of "truely worthless objects" (segment numbers).
26 
27    Note: once a usage count exceeds the declared precision it is never altered.
28    Also, a usage count of zero is never decremented. The appropriate usage count
29    is determined by the process' validation level.
30 
31 */
32 
33 /* Parameters */
34 
35 dcl  a_code                             fixed bin (35) parameter;
36 dcl  a_ring                             fixed bin (3) parameter;
37 dcl  a_segno                            fixed bin (17) parameter;
38 
39 /* Variables */
40 
41 dcl  code                               fixed bin (35);
42 dcl  ring                               fixed bin (3);
43 
44 /* Entries */
45 
46 dcl  level$get                          returns (fixed bin (3));
47 dcl  get_kstep                          entry (fixed bin (17), ptr, fixed bin (35));
48 %page;
49 increment: entry (a_segno, a_code);
50 
51           ring = level$get ();
52 incr:     call setup;
53           if kste.usage_count (ring) >= 0 then
54                kste.usage_count (ring) = kste.usage_count (ring) + 1;
55           return;
56 
57 increment_other_ring: entry (a_segno, a_ring, a_code);
58 
59           ring = a_ring;
60           go to incr;
61 
62 decrement: entry (a_segno, a_code);
63 
64           ring = level$get ();
65           call setup;
66           if kste.usage_count (ring) > 0 then
67                kste.usage_count (ring) = kste.usage_count (ring) - 1;
68           return;
69 %page;
70 setup: proc;
71 
72           call get_kstep ((a_segno), kstep, code);
73           if code ^= 0 then do;
74                a_code = code;
75                go to return_to_caller;
76           end;
77           return;
78      end setup;
79 
80 return_to_caller:
81           return;
82 
83 %page; %include kst;
84      end segno_usage;