File: ansi-c.patch

package info (click to toggle)
a56 1.3%2Bdfsg-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 664 kB
  • sloc: yacc: 7,550; ansic: 5,851; makefile: 231; awk: 4; sh: 1
file content (102 lines) | stat: -rw-r--r-- 2,722 bytes parent folder | download
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
Origin: https://github.com/rkujawa/a56/commit/68dacec16838a482264e67976b23310841bb539c
From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= <radoslaw.kujawa@c0ff33.net>
Date: Fri, 17 May 2013 10:46:34 +0200
Subject: More code cleanup and conversion to ANSI C.
Forwarded: not-needed as there is no upstream anymore
---
--- a/frac2int.c
+++ b/frac2int.c
@@ -98,21 +98,26 @@
 *         signed, fractional quantities.                           *
 \******************************************************************/
 
-main()
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(void)
 {
-           double fractnum;              /* double precision floating pt */
-           long   hexval;                /* long integer */
+	double fractnum;              /* double precision floating pt */
+	long   hexval;                /* long integer */
 
-    for(;;) {
-        /* Read 1 Decimal Floating Point Number from the Keyboard */
-           printf("Enter the decimal fraction: ");
-           scanf("%lf", &fractnum);
+	for(;;) {
+		/* Read 1 Decimal Floating Point Number from the Keyboard */
+		printf("Enter the decimal fraction: ");
+		scanf("%lf", &fractnum);
 
-        /* Convert to a Hex Integer which can be used by the DSP56200 */
-           hexval =  (long) (8388608.0 * fractnum);
-           hexval =  0x00ffffffL & hexval;
+		/* Convert to a Hex Integer which can be used by the DSP56200 */
+		hexval =  (long) (8388608.0 * fractnum);
+		hexval =  0x00ffffffL & hexval;
 
-        /* Write the Hex number out to the Terminal */
-           printf("DSP56200 Coefficient = %06lx\n", hexval);
-    }
+		/* Write the Hex number out to the Terminal */
+		printf("DSP56200 Coefficient = %06lx\n", hexval);
+	}
+	return(EXIT_SUCCESS);
 }
--- a/main.c
+++ b/main.c
@@ -205,7 +205,7 @@ void sym_def(char *sym, int type, int se
 			sp->n.val.f = f;
 	} else {
 		sp = find_sym(sym);
-		if(NOT sp)
+		if(!sp)
 			fatal("internal error 304\n");
 		if(sp->n.type != type ||
 			type == INT && sp->n.val.i != (i & 0xFFFFFF) ||
--- a/torom.c
+++ b/torom.c
@@ -5,7 +5,7 @@
  *  Written by Quinn C. Jensen
  *  July 1990
  *
- *******************************************************\
+ *******************************************************/
 
 /*
  * Copyright (C) 1990-1994 Quinn C. Jensen
@@ -27,12 +27,14 @@ static char *Copyright = "Copyright (C)
  *
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+
 
 #define MAX 256
 
-main(argc,argv)
-int argc;
-char *argv[];
+int
+main(int argc, char *argv[])
 {
 	char buf[MAX];
 	int curaddr = 0;
@@ -59,10 +61,11 @@ char *argv[];
 			}
 		}
 	}
+	return EXIT_SUCCESS;
 }
 
-putword(data)
-int data;
+void 
+putword(int data)
 {
 	putchar(data >>  0 & 0xFF);
 	putchar(data >>  8 & 0xFF);