summaryrefslogtreecommitdiff
path: root/bcc/q
blob: e12439404a5a561d33092a478d2efdfbd69b16a3 (plain)
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
103
104
105
106
107
108
109
110
111
112
diff -u5 -r bcc~/declare.c bcc/declare.c
--- bcc~/declare.c	Fri Dec 17 17:51:13 1999
+++ bcc/declare.c	Thu Jun  6 13:27:00 2002
@@ -410,16 +410,17 @@
 }
 
 PRIVATE bool_pt declspec()
 {
     unsigned nsc;
+    unsigned nsigned;
     unsigned ntype;
     unsigned nunsigned;
 
     gvarsc = NULLDECL;
     gvartype = itype;
-    nunsigned = ntype = nsc = 0;
+    nsigned = nunsigned = ntype = nsc = 0;
     while (TRUE)
     {
 	switch (sym)
 	{
 	case AUTODECL:
diff -u5 -r bcc~/proto.h bcc/proto.h
--- bcc~/proto.h	Sun Jan 11 12:18:36 1998
+++ bcc/proto.h	Thu Jun  6 00:46:24 2002
@@ -360,8 +360,8 @@
 void outntypechar P((struct typestruct *type));
 struct typestruct *pointype P((struct typestruct *type));
 struct typestruct *prefix P((constr_pt constructor, uoffset_T size,
 			     struct typestruct *type));
 struct typestruct *promote P((struct typestruct *type));
+struct typestruct *tosigned P((struct typestruct *type));
 struct typestruct *tounsigned P((struct typestruct *type));
 void typeinit P((void));
-
diff -u5 -r bcc~/scan.h bcc/scan.h
--- bcc~/scan.h	Sat Jul 24 14:27:42 1999
+++ bcc/scan.h	Thu Jun  6 00:32:20 2002
@@ -134,10 +134,11 @@
 
 #define LASTOP PTRSUBOP
 
     ENUMDECL,
     NULLDECL,
+    SIGNDECL,
     STRUCTDECL,
     TYPEDECL,
     TYPEDEFNAME,
     UNIONDECL,
     UNSIGNDECL,
diff -u5 -r bcc~/table.c bcc/table.c
--- bcc~/table.c	Sun Sep 28 09:57:30 1997
+++ bcc/table.c	Thu Jun  6 00:29:36 2002
@@ -28,11 +28,11 @@
 #define MAXEXPR 125
 #else
 #define MAXEXPR 500
 #endif
 #define MAXLOCAL 100
-#define NKEYWORDS 35
+#define NKEYWORDS 36
 #ifdef NOFLOAT
 #define NSCALTYPES 10
 #else
 #define NSCALTYPES 12
 #endif
@@ -88,11 +88,12 @@
 PRIVATE struct keywordstruct keywords[NKEYWORDS] =
 {
     { "enum", ENUMDECL, },
     { "struct", STRUCTDECL, },
     { "union", UNIONDECL, },
     { "unsigned", UNSIGNDECL, },
+    { "signed", SIGNDECL, },
 
     { "auto", AUTODECL, },
     { "extern", EXTERNDECL, },
     { "register", REGDECL, },
     { "static", STATICDECL, },
diff -u5 -r bcc~/type.c bcc/type.c
--- bcc~/type.c	Sun Jan 11 12:18:37 1998
+++ bcc/type.c	Thu Jun  6 00:49:06 2002
@@ -155,10 +155,29 @@
     if (type->constructor & FUNCTION)
 	return pointype(type);
     return type;
 }
 
+PUBLIC struct typestruct *tosigned(type)
+struct typestruct *type;
+{
+    switch (type->scalar & ~(UNSIGNED | DLONG))
+    {
+    case CHAR:
+	return sctype;
+    case SHORT:
+	return stype;
+    case INT:
+	return itype;
+    case LONG:
+	return ltype;
+    default:
+	error("signed only applies to integral types");
+	return type;
+    }
+}
+
 PUBLIC struct typestruct *tounsigned(type)
 struct typestruct *type;
 {
     switch (type->scalar & ~(UNSIGNED | DLONG))
     {