File: expcode.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 (75 lines) | stat: -rw-r--r-- 3,009 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
/*		
 *		GRAMophone II, a grammar based algorithmic musical composition tool
 *		--------------------------------------------------------------------
 *		
 *		expcode.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"

extern char idTemp[];
unsigned int id;

void gen_exp1_code(unsigned int op, unsigned int type1, unsigned int op1,
		  unsigned int type2, unsigned int op2) {

  id=hash(idTemp, 0);
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][0]=op; 
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][1]=type1; 
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][2]=op1;
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][3]=type2;
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec++][4]=op2;
}

void gen_exp2_code(unsigned int op, unsigned int op1, unsigned int type,
		   unsigned int op2) {

  id=hash(idTemp, 0);	
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][0]=op;	 
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][1]=op1;
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][2]=type;  
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec++][3]=op2;
}

void gen_exp3_code(unsigned int op, unsigned int type, unsigned int op1) {
  id=hash(idTemp, 0);
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][0]=op;
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec][1]=type;
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec++][2]=op1;
}

void gen_exp4_code(unsigned int op) {
  id=hash(idTemp, 0);
 
  players[playerCount]->productions[id]->exp->expcode[players[playerCount]->
    productions[id]->ec++][0]=op;
}