Introduction
Introduction Statistics Contact Development Disclaimer Help
Removed old uchar definition. - sam - An updated version of the sam text editor.
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 2832a9cdfbb306f063f6456bf7c9c743556111ec
parent 7827b57212dabd01b471b7ab821f1862b666dd07
Author: Rob King <[email protected]>
Date: Tue, 27 Sep 2016 11:25:52 -0500
Removed old uchar definition.
Diffstat:
include/frame.h | 4 ++--
include/u.h | 1 -
libXg/menuhit.c | 2 +-
libXg/rune.c | 12 ++++++------
libframe/frbox.c | 8 ++++----
libframe/frinsert.c | 2 +-
libframe/frptofchar.c | 4 ++--
libframe/frstr.c | 6 +++---
libframe/frutil.c | 2 +-
sam/cmd.c | 4 ++--
sam/io.c | 2 +-
sam/mesg.c | 12 ++++++------
sam/mesg.h | 8 ++++----
sam/parse.h | 12 ++++++------
sam/sam.h | 4 ++--
samterm/icons.c | 2 +-
samterm/io.c | 10 +++++-----
samterm/main.c | 2 +-
samterm/menu.c | 8 ++++----
samterm/mesg.c | 16 ++++++++--------
samterm/samterm.h | 8 ++++----
samterm/unix.c | 4 ++--
22 files changed, 66 insertions(+), 67 deletions(-)
---
diff --git a/include/frame.h b/include/frame.h
@@ -8,7 +8,7 @@ struct Frbox
int64_t wid; /* in pixels */
int64_t nrune; /* <0 ==> negate and treat as break char */
union{
- uchar *ptr;
+ uint8_t *ptr;
struct{
int16_t bc; /* break char */
int16_t minwid;
@@ -51,7 +51,7 @@ void frsetrects(Frame*, Rectangle, Bitmap*);
void frclear(Frame*);
void frgetmouse(void);
-uchar *_frallocstr(unsigned);
+uint8_t *_frallocstr(unsigned);
void _frinsure(Frame*, int, unsigned);
Point _frdraw(Frame*, Point);
void _frgrowbox(Frame*, int);
diff --git a/include/u.h b/include/u.h
@@ -9,5 +9,4 @@
#include <unistd.h>
#include <wchar.h>
-typedef uint8_t uchar;
typedef uint16_t Rune;
diff --git a/libXg/menuhit.c b/libXg/menuhit.c
@@ -18,7 +18,7 @@ enum
static Bitmap *menutxt;
-static uchar menutxtbits[] = {
+static uint8_t menutxtbits[] = {
0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88,
diff --git a/libXg/rune.c b/libXg/rune.c
@@ -37,7 +37,7 @@ chartorune(Rune *rune, char *str)
* one character sequence
* 00000-0007F => T1
*/
- c = *(uchar*)str;
+ c = *(uint8_t*)str;
if(c < Tx) {
*rune = c;
return 1;
@@ -47,7 +47,7 @@ chartorune(Rune *rune, char *str)
* two character sequence
* 0080-07FF => T2 Tx
*/
- c1 = *(uchar*)(str+1) ^ Tx;
+ c1 = *(uint8_t*)(str+1) ^ Tx;
if(c1 & Testx)
goto bad;
if(c < T3) {
@@ -64,7 +64,7 @@ chartorune(Rune *rune, char *str)
* three character sequence
* 0800-FFFF => T3 Tx Tx
*/
- c2 = *(uchar*)(str+2) ^ Tx;
+ c2 = *(uint8_t*)(str+2) ^ Tx;
if(c2 & Testx)
goto bad;
if(c < T4) {
@@ -153,7 +153,7 @@ fullrune(char *str, int n)
int c;
if(n > 0) {
- c = *(uchar*)str;
+ c = *(uint8_t*)str;
if(c < Tx)
return 1;
if(n > 1)
@@ -174,7 +174,7 @@ utfrune(char *s, int64_t c)
return strchr(s, c);
for(;;) {
- c1 = *(uchar*)s;
+ c1 = *(uint8_t*)s;
if(c1 < Runeself) { /* one byte rune */
if(c1 == 0)
return 0;
@@ -200,7 +200,7 @@ utflen(char *s)
n = 0;
for(;;) {
- c = *(uchar*)s;
+ c = *(uint8_t*)s;
if(c < Runeself) {
if(c == 0)
return n;
diff --git a/libframe/frbox.c b/libframe/frbox.c
@@ -71,7 +71,7 @@ static
void
dupbox(Frame *f, int bn)
{
- uchar *p;
+ uint8_t *p;
if(f->box[bn].nrune < 0)
berror("dupbox");
@@ -84,8 +84,8 @@ dupbox(Frame *f, int bn)
}
static
-uchar*
-runeindex(uchar *p, int n)
+uint8_t*
+runeindex(uint8_t *p, int n)
{
int i, w;
Rune rune;
@@ -118,7 +118,7 @@ chopbox(Frame *f, Frbox *b, int n) /* drop first n chars; …
if(b->nrune<0 || b->nrune<n)
berror("chopbox");
- uchar *ri = runeindex(b->a.ptr, n);
+ uint8_t *ri = runeindex(b->a.ptr, n);
memmove(b->a.ptr, ri, strlen((char *)ri) + 1);
b->nrune -= n;
b->wid = strwidth(f->font, (char *)b->a.ptr);
diff --git a/libframe/frinsert.c b/libframe/frinsert.c
@@ -15,7 +15,7 @@ bxscan(Frame *f, Rune *sp, Rune *ep, Point *ppt)
int w, c, nb, delta, nl, nr, rw;
Frbox *b;
char *s, tmp[TMPSIZE+3]; /* +3 for rune overflow */
- uchar *p;
+ uint8_t *p;
frame.r = f->r;
frame.b = f->b;
diff --git a/libframe/frptofchar.c b/libframe/frptofchar.c
@@ -7,7 +7,7 @@
Point
_frptofcharptb(Frame *f, uint64_t p, Point pt, int bn)
{
- uchar *s;
+ uint8_t *s;
Frbox *b;
int w, l;
Rune r;
@@ -69,7 +69,7 @@ frcharofpt(Frame *f, Point pt)
{
Point qt;
int w, bn;
- uchar *s;
+ uint8_t *s;
Frbox *b;
uint64_t p;
Rune r;
diff --git a/libframe/frstr.c b/libframe/frstr.c
@@ -11,10 +11,10 @@
#define CHUNK 16
#define ROUNDUP(n) ((n+CHUNK)&~(CHUNK-1))
-uchar *
+uint8_t *
_frallocstr(unsigned n)
{
- uchar *p;
+ uint8_t *p;
p = malloc(ROUNDUP(n));
if(p == 0)
@@ -26,7 +26,7 @@ void
_frinsure(Frame *f, int bn, unsigned n)
{
Frbox *b;
- uchar *p;
+ uint8_t *p;
b = &f->box[bn];
if(b->nrune < 0)
diff --git a/libframe/frutil.c b/libframe/frutil.c
@@ -8,7 +8,7 @@ int
_frcanfit(Frame *f, Point pt, Frbox *b)
{
int left, w, nr;
- uchar *p;
+ uint8_t *p;
Rune r;
left = f->r.max.x-pt.x;
diff --git a/sam/cmd.c b/sam/cmd.c
@@ -274,9 +274,9 @@ freecmd(void)
int i;
while(cmdlist.nused > 0)
- free(cmdlist.ucharpptr[--cmdlist.nused]);
+ free(cmdlist.uint8_tpptr[--cmdlist.nused]);
while(addrlist.nused > 0)
- free(addrlist.ucharpptr[--addrlist.nused]);
+ free(addrlist.uint8_tpptr[--addrlist.nused]);
while(relist.nused > 0){
i = --relist.nused;
Strclose(relist.stringpptr[i]);
diff --git a/sam/io.c b/sam/io.c
@@ -89,7 +89,7 @@ readio(File *f, int *nulls, int setdate)
r = genbuf;
s = buf;
while(n > 0){
- if((*r = *(uchar*)s) < Runeself){
+ if((*r = *(uint8_t*)s) < Runeself){
if(*r)
r++;
else
diff --git a/sam/mesg.c b/sam/mesg.c
@@ -2,11 +2,11 @@
#include "sam.h"
Header h;
-uchar indata[DATASIZE];
-uchar outdata[2*DATASIZE+3]; /* room for overflow message */
-uchar *inp;
-uchar *outp;
-uchar *outmsg = outdata;
+uint8_t indata[DATASIZE];
+uint8_t outdata[2*DATASIZE+3]; /* room for overflow message */
+uint8_t *inp;
+uint8_t *outp;
+uint8_t *outmsg = outdata;
Posn cmdpt;
Posn cmdptadv;
Buffer *snarfbuf;
@@ -98,7 +98,7 @@ journaln(int out, int64_t n)
int
rcvchar(void){
- static uchar buf[64];
+ static uint8_t buf[64];
static int i, nleft = 0;
if(nleft <= 0){
diff --git a/sam/mesg.h b/sam/mesg.h
@@ -69,10 +69,10 @@ typedef enum Hmesg
HMAX
}Hmesg;
typedef struct Header{
- uchar type; /* one of the above */
- uchar count0; /* low bits of data size */
- uchar count1; /* high bits of data size */
- uchar data[1]; /* variable size */
+ uint8_t type; /* one of the above */
+ uint8_t count0; /* low bits of data size */
+ uint8_t count1; /* high bits of data size */
+ uint8_t data[1]; /* variable size */
}Header;
/*
* File transfer protocol schematic, a la Holzmann
diff --git a/sam/parse.h b/sam/parse.h
@@ -36,12 +36,12 @@ struct Cmd
extern struct cmdtab{
uint16_t cmdc; /* command character */
- uchar text; /* takes a textual argument? */
- uchar regexp; /* takes a regular expression? */
- uchar addr; /* takes an address (m or t)? */
- uchar defcmd; /* default command; 0==>none */
- uchar defaddr; /* default address */
- uchar count; /* takes a count e.g. s2/// */
+ uint8_t text; /* takes a textual argument? */
+ uint8_t regexp; /* takes a regular expression? */
+ uint8_t addr; /* takes an address (m or t)? */
+ uint8_t defcmd; /* default command; 0==>none */
+ uint8_t defaddr; /* default address */
+ uint8_t count; /* takes a count e.g. s2/// */
char *token; /* takes text terminated by one of these */
int (*fn)(File*, Cmd*); /* function to call with parse tree */
}cmdtab[];
diff --git a/sam/sam.h b/sam/sam.h
@@ -67,7 +67,7 @@ struct List /* code depends on a int64_t being able to hold a…
void *listp;
Block *blkp;
int64_t *longp;
- uchar* *ucharp;
+ uint8_t* *uint8_tp;
String* *stringp;
File* *filep;
int64_t listv;
@@ -77,7 +77,7 @@ struct List /* code depends on a int64_t being able to hold a…
#define listptr g.listp
#define blkptr g.blkp
#define longptr g.longp
-#define ucharpptr g.ucharp
+#define uint8_tpptr g.uint8_tp
#define stringpptr g.stringp
#define filepptr g.filep
#define listval g.listv
diff --git a/samterm/icons.c b/samterm/icons.c
@@ -3,7 +3,7 @@
#include <libc.h>
#include <libg.h>
-uchar darkgreybits[] = {
+uint8_t darkgreybits[] = {
0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
0xDD, 0xDD, 0x77, 0x77, 0xDD, 0xDD, 0x77, 0x77,
diff --git a/samterm/io.c b/samterm/io.c
@@ -12,11 +12,11 @@ int got;
int block;
Keystroke keystroke;
int reshaped;
-uchar *hostp;
-uchar *hoststop;
-uchar *externbase;
-uchar *externp;
-uchar *externstop;
+uint8_t *hostp;
+uint8_t *hoststop;
+uint8_t *externbase;
+uint8_t *externp;
+uint8_t *externstop;
void panic(char*);
void
diff --git a/samterm/main.c b/samterm/main.c
@@ -204,7 +204,7 @@ closeup(Flayer *l)
work = 0;
if(--t->nwin == 0){
rclear(&t->rasp);
- free((uchar *)t);
+ free(t);
text[m] = 0;
}else if(l == &t->l[t->front]){
for(m=0; m<NL; m++) /* find one; any one will do */
diff --git a/samterm/menu.c b/samterm/menu.c
@@ -6,7 +6,7 @@
#include "flayer.h"
#include "samterm.h"
-uchar *name[MAXFILES]; /* first byte is ' ' or '\'': modified state */
+uint8_t *name[MAXFILES]; /* first byte is ' ' or '\'': modified state */
Text *text[MAXFILES]; /* pointer to Text associated with file */
uint16_t tag[MAXFILES]; /* text[i].tag, even if text[i] not defined */
int nname;
@@ -225,7 +225,7 @@ whichmenu(int tg)
}
void
-menuins(int n, uchar *s, Text *t, int m, int tg)
+menuins(int n, uint8_t *s, Text *t, int m, int tg)
{
int i;
@@ -272,12 +272,12 @@ haspat(void)
}
#define NBUF 64
-static uchar buf[NBUF*UTFmax]={' ', ' ', ' ', ' '};
+static uint8_t buf[NBUF*UTFmax]={' ', ' ', ' ', ' '};
char *
paren(char *s)
{
- uchar *t = buf;
+ uint8_t *t = buf;
*t++ = '(';
do; while((*t++ = *s++));
diff --git a/samterm/mesg.c b/samterm/mesg.c
@@ -12,8 +12,8 @@ extern Flayer *flast;
#define HSIZE 3 /* Type + int16_t count */
Header h;
-uchar indata[DATASIZE+1]; /* room for NUL */
-uchar outdata[DATASIZE];
+uint8_t indata[DATASIZE+1]; /* room for NUL */
+uint8_t outdata[DATASIZE];
int16_t outcount;
int hversion;
@@ -173,7 +173,7 @@ inmesg(Hmesg type, int count)
break;
case Hnewname:
- menuins(0, (uchar *)"", (Text *)0, ' ', m);
+ menuins(0, (uint8_t *)"", (Text *)0, ' ', m);
break;
case Hcheck0:
@@ -438,7 +438,7 @@ outTslS(Tmesg type, int s1, int64_t l1, Rune *s)
while(*s)
c += runetochar(c, s++);
*c++ = 0;
- outcopy(c-buf, (uchar *)buf);
+ outcopy(c-buf, (uint8_t *)buf);
outsend();
}
@@ -460,7 +460,7 @@ outstart(Tmesg type)
}
void
-outcopy(int count, uchar *data)
+outcopy(int count, uint8_t *data)
{
while(count--)
outdata[HSIZE+outcount++] = *data++;
@@ -469,7 +469,7 @@ outcopy(int count, uchar *data)
void
outshort(int s)
{
- uchar buf[2];
+ uint8_t buf[2];
buf[0]=s;
buf[1]=s>>8;
@@ -480,7 +480,7 @@ void
outlong(int64_t l)
{
int i;
- uchar buf[8];
+ uint8_t buf[8];
for(i = 0; i < sizeof(buf); i++, l >>= 8)
buf[i] = l;
@@ -707,7 +707,7 @@ hdata1(Text *t, int64_t a, Rune *r, int len)
}
int
-hdata(int m, int64_t a, uchar *s, int len)
+hdata(int m, int64_t a, uint8_t *s, int len)
{
int i, w;
Text *t = whichtext(m);
diff --git a/samterm/samterm.h b/samterm/samterm.h
@@ -79,7 +79,7 @@ enum Resource
};
extern Text *text[];
-extern uchar *name[];
+extern uint8_t *name[];
extern uint16_t tag[];
extern int nname;
extern unsigned int cursor;
@@ -143,10 +143,10 @@ int whichmenu(int);
void hcut(int, int64_t, int64_t);
void horigin(int, int64_t, Flayer *);
void hgrow(int, int64_t, int64_t, int);
-int hdata(int, int64_t, uchar*, int);
+int hdata(int, int64_t, uint8_t*, int);
int hdatarune(int, int64_t, Rune*, int);
Rune *rload(Rasp*, uint64_t, uint64_t, uint64_t*);
-void menuins(int, uchar*, Text*, int, int);
+void menuins(int, uint8_t*, Text*, int, int);
void menudel(int);
Text *sweeptext(int, int);
void setpat(char*);
@@ -178,7 +178,7 @@ void outTsll(Tmesg, int, int64_t, int64_t);
void outTsl(Tmesg, int, int64_t);
void outTv(Tmesg, void*);
void outstart(Tmesg);
-void outcopy(int, uchar*);
+void outcopy(int, uint8_t*);
void outshort(int);
void outlong(int64_t);
void outsend(void);
diff --git a/samterm/unix.c b/samterm/unix.c
@@ -47,10 +47,10 @@ screensize(int *w, int *h)
void
dumperrmsg(int count, int type, int count0, int c)
{
- uchar *cp;
+ uint8_t *cp;
int i;
- cp = (uchar *) rcvstring();
+ cp = (uint8_t *) rcvstring();
fprintf(stderr, "samterm: host mesg: count %d %ux %ux %ux %s...ignored\n",
count, type, count0, c, cp);
i = 0;
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.