File: debug.c

package info (click to toggle)
gramophone2 0.8.13a-3.6
  • links: PTS
  • area: main
  • in suites: sid
  • size: 544 kB
  • sloc: ansic: 2,707; yacc: 1,873; lex: 308; makefile: 33
file content (82 lines) | stat: -rw-r--r-- 2,889 bytes parent folder | download | duplicates (5)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*		
 *		GRAMophone II, a grammar based algorithmic musical composition tool
 *		--------------------------------------------------------------------
 *		
 *		debug.c
 *
 *		Copyright (c) 2007, Giovanni Ferranti <giovanni@giovanniferranti.it>
 *
 * 		GRAMophone II is free software; you can redistribute it and/or modify
 * 		it under the terms of the GNU General Public License as published by
 * 		the Free Software Foundation; either version 2 of the License, or
 * 		(at your option) any later version.
 *
 * 		This program is distributed in the hope that it will be useful,
 * 		but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * 		GNU Library General Public License for more details.
 *
 *		You should have received a copy of the GNU General Public License along
 *		with this program; if not, write to the Free Software Foundation, Inc.,
 *		51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *		-------------------------------------------------------------------
 */

#include "global.h"

void print_composition_info() {
	printf("Composition Info:\n\n");
	printf("Title: %s\nAuthor and Copyright: %s\n", title, copyright);
	printf("\n");
}

void print_global_params() {
	register unsigned char i;
	
	printf("Global Parameters:\n\n");
	printf("Default grammar: %d\n", grammarOption);
	printf("Default iterations: %d\n", global_iterations);
	printf("Default resolution: %d\n", global_resolution);
	printf("Default time signature: %d/%d\n", glob_num, glob_den);
	printf("Default tempo: %d\n", tempo);
	for(i=0; i<NUM_GLOBAL_PARAMS; i++)
		printf("Parameter %d: %d\n", i, global_params[i]);
	printf("\n");	
}

void print_local_params(unsigned char i) {
	register unsigned char j;
	
	if(i)
		printf("\n");
	printf("Player: %s\n\n", players[i]->identifier);
	printf("Local Parameters:\n\n");
	if(players[i]) {
		printf("Grammar: %d\n", players[i]->grammar);
		//printf("Time signature: %d/%d\n", players[i]->num, players[i]->den);
		printf("Iterations: %d\n", players[i]->iterations);
		for(j=0; j<NUM_LOCAL_PARAMS; j++)
			printf("Parameter %d: %d\n", j, players[i]->local_params[j]);
		printf("\n");	
	}
	printf("\n");	
}

void print_expression_memory_map() {
	register unsigned int i, j, w=0;
	
	for(i=0; i<playerCount; i++)
		if(players[i])
			for(j=0; j<NUM_PRODS; j++)
				if(players[i]->productions[j])
					if(players[i]->productions[j]->exp)
						while(players[i]->productions[j]->exp->expcode[w][0]) {
							printf("%d ", players[i]->productions[j]->exp->expcode[w][0]);
							printf("%d ", players[i]->productions[j]->exp->expcode[w][1]);
							printf("%d ", players[i]->productions[j]->exp->expcode[w][2]);
							printf("%d ", players[i]->productions[j]->exp->expcode[w][3]);
							printf("%d ", players[i]->productions[j]->exp->expcode[w++][4]);
							printf("\n");
					}
}