1
/**************************************************************/
2
/* ********************************************************** */
4
/* * GLOBAL SYSTEM VECTOR * */
6
/* * $Module: VECTOR * */
8
/* * Copyright (C) 1996, 2000, 2001 MPI fuer Informatik * */
10
/* * This program is free software; you can redistribute * */
11
/* * it and/or modify it under the terms of the FreeBSD * */
14
/* * This program is distributed in the hope that it will * */
15
/* * be useful, but WITHOUT ANY WARRANTY; without even * */
16
/* * the implied warranty of MERCHANTABILITY or FITNESS * */
17
/* * FOR A PARTICULAR PURPOSE. See the LICENCE file * */
18
/* * for more details. * */
21
/* $Revision: 1.2 $ * */
23
/* $Date: 2010-02-22 14:10:00 $ * */
24
/* $Author: weidenb $ * */
27
/* * Christoph Weidenbach * */
28
/* * MPI fuer Informatik * */
29
/* * Stuhlsatzenhausweg 85 * */
30
/* * 66123 Saarbruecken * */
31
/* * Email: spass@mpi-inf.mpg.de * */
34
/* ********************************************************** */
35
/**************************************************************/
38
/* $RCSfile: vector.c,v $ */
42
/**************************************************************/
43
/* Global Variables */
44
/**************************************************************/
50
/**************************************************************/
52
/**************************************************************/
54
void vec_Swap(int i, int j)
55
/**********************************************************
56
INPUT: Two integers i and j which designate the i-th and
57
the j-th cell of the vector.
59
CAUTION: The values in the i-th and the j-th cell in the
60
vector are interchanged.
61
********************************************************/
66
vec_PutNth(i, vec_GetNth(j));
72
void vec_PrintSel(int beg, int end, void (*ElementPrint)(POINTER))
73
/**********************************************************
74
INPUT: An int for the start position, an int for
75
the end position and a print function for
78
EFFECT: Writes the vector from beg to end to stdout.
80
********************************************************/
84
if (vec_ActMax() > 0) {
85
for (i = beg; i < end; i++){
86
printf("Entry %d:\t",i);
87
ElementPrint(vec_GetNth(i));
91
puts("Vector is empty");
95
void vec_PrintAll(void (*ElementPrint)(POINTER))
96
/**********************************************************
97
INPUT: A print function for the elements of the vector.
99
EFFECT: Writes the vector to stdout.
101
********************************************************/
105
if (vec_ActMax() > 0) {
106
for (i = 0; i < vec_ActMax(); i++) {
107
printf("Entry %d:\t", i);
108
ElementPrint(vec_GetNth(i));
112
puts("Vector is empty");