[svn-commits] trunk r1012 - in /trunk: ./ Makefile gendigits.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Apr 30 08:39:49 MST 2006


Author: kpfleming
Date: Sun Apr 30 10:39:48 2006
New Revision: 1012

URL: http://svn.digium.com/view/zaptel?rev=1012&view=rev
Log:
Merged revisions 1011 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r1011 | kpfleming | 2006-04-30 10:38:37 -0500 (Sun, 30 Apr 2006) | 2 lines

allow the output of gendigits to be redirected to a different directory from the current working directory

........

Modified:
    trunk/   (props changed)
    trunk/Makefile
    trunk/gendigits.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.2-merged (original)
+++ branch-1.2-merged Sun Apr 30 10:39:48 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-916,918-936,938-949,958,962,970,990,1004
+/branches/1.2:1-916,918-936,938-949,958,962,970,990,1004,1011

Modified: trunk/Makefile
URL: http://svn.digium.com/view/zaptel/trunk/Makefile?rev=1012&r1=1011&r2=1012&view=diff
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Sun Apr 30 10:39:48 2006
@@ -249,7 +249,7 @@
 	$(CC) -o $@ $^
 
 tones.h: gendigits
-	./gendigits
+	./gendigits > $@
 
 tor2fw.h: makefw tormenta2.rbt
 	./makefw tormenta2.rbt tor2fw > tor2fw.h

Modified: trunk/gendigits.c
URL: http://svn.digium.com/view/zaptel/trunk/gendigits.c?rev=1012&r1=1011&r2=1012&view=diff
==============================================================================
--- trunk/gendigits.c (original)
+++ trunk/gendigits.c Sun Apr 30 10:39:48 2006
@@ -95,7 +95,7 @@
   return(ulawbyte);
 }                                                                                            
 
-int process(FILE *f, char *label, ZAP_DIAL z[], float low_tone_level, float high_tone_level)
+int process(char *label, ZAP_DIAL z[], float low_tone_level, float high_tone_level)
 {
 	char c;
 	float gain;
@@ -119,7 +119,7 @@
 		init_v2_2 = sin(-4.0 * M_PI * (z->f2 / 8000.0)) * gain;
 		init_v3_2 = sin(-2.0 * M_PI * (z->f2 / 8000.0)) * gain;
 
-		fprintf(f, "\t /* %s_%c */ { %d, %d, %d, %d, %d, %d, DEFAULT_DTMF_LENGTH, &%s_silence }, \n", label, c,
+		printf("\t /* %s_%c */ { %d, %d, %d, %d, %d, %d, DEFAULT_DTMF_LENGTH, &%s_silence }, \n", label, c,
 			fac1, init_v2_1, init_v3_1, 
 			fac2, init_v2_2, init_v3_2,
 			label);
@@ -141,23 +141,15 @@
 
 int main(int argc, char *argv[])
 {
-	FILE *f;
-	
-	if ((f = fopen("tones.h", "w"))) {
-		fprintf(f, "/* DTMF and MF tones used by the Tormenta Driver, in static tables.\n"
+	printf("/* DTMF and MF tones used by the Tormenta Driver, in static tables.\n"
 				   "   Generated automatically from gendigits.  Do not edit by hand.  */\n"); 
-		fprintf(f, "static struct zt_tone dtmf_tones[16] = {\n");
-		process(f, "dtmf", dtmf_dial, LEVEL_DTMF_LOW, LEVEL_DTMF_HIGH);
-		fprintf(f, "};\n\n");
-		fprintf(f, "static struct zt_tone mfv1_tones[15] = {\n");
-		process(f, "mfv1", mf_dial, LEVEL_MF, LEVEL_MF);
-		fprintf(f, "};\n\n");
-		fprintf(f, "/* END tones.h */\n");
-		fclose(f);
-	} else {
-		fprintf(stderr, "Unable to open tones.h for writing\n");
-		return 1;
-	}
+	printf("static struct zt_tone dtmf_tones[16] = {\n");
+	process("dtmf", dtmf_dial, LEVEL_DTMF_LOW, LEVEL_DTMF_HIGH);
+	printf("};\n\n");
+	printf("static struct zt_tone mfv1_tones[15] = {\n");
+	process("mfv1", mf_dial, LEVEL_MF, LEVEL_MF);
+	printf("};\n\n");
+	printf("/* END tones.h */\n");
 
 	return 0;
 }   



More information about the svn-commits mailing list