1 |
/* |
2 |
* listio.c |
3 |
* List I/O Routines |
4 |
* by Ben Allan |
5 |
* Created: 12/97 |
6 |
* Version: $Revision: 1.2 $ |
7 |
* Version control file: $RCSfile: listio.c,v $ |
8 |
* Date last modified: $Date: 1998/06/16 15:47:41 $ |
9 |
* Last modified by: $Author: mthomas $ |
10 |
* |
11 |
* This file is part of the ASCEND Language Interpreter |
12 |
* |
13 |
* Copyright (C) 1998 Carnegie Mellon University |
14 |
* |
15 |
* The ASCEND Language Interpreter is free software; you can |
16 |
* redistribute it and/or modify it under the terms of the GNU |
17 |
* General Public License as published by the Free Software |
18 |
* Foundation; either version 2 of the License, or (at your option) |
19 |
* any later version. |
20 |
* |
21 |
* The ASCEND Language Interpreter is distributed in hope that it |
22 |
* will be useful, but WITHOUT ANY WARRANTY; without even the implied |
23 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
24 |
* See the GNU General Public License for more details. |
25 |
* |
26 |
* You should have received a copy of the GNU General Public License |
27 |
* along with the program; if not, write to the Free Software |
28 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |
29 |
* the file named COPYING. COPYING is found in ../compiler. |
30 |
*/ |
31 |
|
32 |
#include <stdio.h> |
33 |
#include "utilities/ascConfig.h" |
34 |
#include "utilities/ascPanic.h" |
35 |
#include "general/list.h" |
36 |
#include "general/listio.h" |
37 |
|
38 |
void gl_write_list(FILE *fp, struct gl_list_t *l) |
39 |
{ |
40 |
unsigned long c,len; |
41 |
FILE *myfp; |
42 |
|
43 |
asc_assert(NULL != l); |
44 |
|
45 |
if (fp==NULL) { |
46 |
myfp = stderr; |
47 |
} else { |
48 |
myfp = fp; |
49 |
} |
50 |
len = gl_length(l); |
51 |
for (c= 1; c <= len ; c++) { |
52 |
fprintf(myfp,"%lu: 0x%p (%lu)\n",c,gl_fetch(l,c), |
53 |
(unsigned long)gl_fetch(l,c)); |
54 |
} |
55 |
} |