2
* Copyright 1987, 1988 by MIT Student Information Processing Board
4
* Permission to use, copy, modify, and distribute this software and
5
* its documentation for any purpose is hereby granted, provided that
6
* the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
7
* advertising or publicity pertaining to distribution of the software
8
* without specific, written prior permission. M.I.T. and the
9
* M.I.T. S.I.P.B. make no representations about the suitability of
10
* this software for any purpose. It is provided "as is" without
11
* express or implied warranty.
18
#include "ss_internal.h"
20
#define ssrt ss_request_table /* for some readable code... */
22
void ss_add_request_table(sci_idx, rqtbl_ptr, position, code_ptr)
25
int position; /* 1 -> becomes second... */
28
register ss_data *info;
31
info = ss_info(sci_idx);
32
for (size=0; info->rqt_tables[size] != (ssrt *)NULL; size++)
34
/* size == C subscript of NULL == #elements */
35
size += 2; /* new element, and NULL */
36
info->rqt_tables = (ssrt **)realloc((char *)info->rqt_tables,
37
(unsigned)size*sizeof(ssrt));
38
if (info->rqt_tables == (ssrt **)NULL) {
42
if (position > size - 2)
46
for (i = size - 2; i >= position; i--)
47
info->rqt_tables[i+1] = info->rqt_tables[i];
49
info->rqt_tables[position] = rqtbl_ptr;
50
info->rqt_tables[size-1] = (ssrt *)NULL;
54
void ss_delete_request_table(sci_idx, rqtbl_ptr, code_ptr)
59
register ss_data *info;
60
register ssrt **rt1, **rt2;
62
*code_ptr = SS_ET_TABLE_NOT_FOUND;
63
info = ss_info(sci_idx);
64
rt1 = info->rqt_tables;
65
for (rt2 = rt1; *rt1; rt1++) {
66
if (*rt1 != rqtbl_ptr) {