forked from stepcode/stepcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpretty_alg.c
More file actions
50 lines (41 loc) · 1.15 KB
/
pretty_alg.c
File metadata and controls
50 lines (41 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/** \file pretty_alg.c
* split out of exppp.c 9/21/13
*/
#include <express/scope.h>
#include <express/linklist.h>
#include <exppp/exppp.h>
#include "pp.h"
#include "pretty_type.h"
#include "pretty_expr.h"
#include "pretty_scope.h"
#include "pretty_alg.h"
void ALGscope_out( Scope s, int level ) {
SCOPEtypes_out( s, level );
SCOPEentities_out( s, level );
SCOPEalgs_out( s, level );
SCOPEconsts_out( s, level );
SCOPElocals_out( s, level );
}
/** last arg is not terminated with ; or \n */
void ALGargs_out( Linked_List args, int level ) {
Type previoustype = 0;
indent2 = level + exppp_continuation_indent;
/* combine adjacent parameters that have the same type */
LISTdo( args, v, Variable )
if( previoustype != v->type ) {
if( previoustype ) {
wrap( " : " );
TYPE_head_out( previoustype, NOLEVEL );
raw( ";\n" );
}
raw( "%*s", level, "" );
EXPR_out( VARget_name( v ), 0 );
} else {
raw( ", " );
EXPR_out( VARget_name( v ), 0 );
}
previoustype = v->type;
LISTod
wrap( " : " );
TYPE_head_out( previoustype, NOLEVEL );
}