Standardize on 64-bit longs. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 7db039abc42d7c4c57e80b7c3856938bae6ead98
(DIR) parent b162248ab4f3f087457c385a3007f2fd47ddef5e
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Tue, 27 Sep 2016 11:04:33 -0500
Standardize on 64-bit longs.
Diffstat:
include/frame.h | 4 ++--
include/libc.h | 6 +++---
include/libg.h | 4 ++--
libXg/rune.c | 12 ++++++------
sam/cmd.c | 8 ++++----
sam/file.c | 2 +-
sam/io.c | 4 ++--
sam/list.c | 12 ++++++------
sam/mesg.c | 16 ++++++++--------
sam/moveto.c | 2 +-
sam/multi.c | 4 ++--
sam/regexp.c | 6 +++---
sam/sam.c | 2 +-
sam/sam.h | 58 +++++++++++++++---------------
sam/shell.c | 4 ++--
sam/sys.c | 2 +-
sam/unix.c | 4 ++--
samterm/flayer.c | 10 +++++-----
samterm/flayer.h | 16 ++++++++--------
samterm/main.c | 154 ++++++++++++++++----------------
samterm/mesg.c | 56 ++++++++++++++++----------------
samterm/rasp.c | 16 ++++++++--------
samterm/samterm.h | 50 ++++++++++++++++----------------
samterm/scroll.c | 12 ++++++------
24 files changed, 232 insertions(+), 232 deletions(-)
---
(DIR) diff --git a/include/frame.h b/include/frame.h
@@ -5,8 +5,8 @@ typedef struct Frame Frame;
struct Frbox
{
- long wid; /* in pixels */
- long nrune; /* <0 ==> negate and treat as break char */
+ int64_t wid; /* in pixels */
+ int64_t nrune; /* <0 ==> negate and treat as break char */
union{
uchar *ptr;
struct{
(DIR) diff --git a/include/libc.h b/include/libc.h
@@ -34,15 +34,15 @@ enum
*/
extern int runetochar(char*, Rune*);
extern int chartorune(Rune*, char*);
-extern int runelen(long);
+extern int runelen(int64_t);
extern int fullrune(char*, int);
/*
* rune routines from converted str routines
*/
extern int utflen(char*); /* was countrune */
-extern char* utfrune(char*, long);
-extern char* utfrrune(char*, long);
+extern char* utfrune(char*, int64_t);
+extern char* utfrrune(char*, int64_t);
extern char* utfutf(char*, char*);
/*
* Miscellaneous functions
(DIR) diff --git a/include/libg.h b/include/libg.h
@@ -179,9 +179,9 @@ extern void bitblt(Bitmap*, Point, Bitmap*, Rectangle, Fcode);
extern Point string(Bitmap*, Point, XftFont*, char*, Fcode);
-extern long strwidth(XftFont*, char*);
+extern int64_t strwidth(XftFont*, char*);
extern Point strsize(XftFont*, char*);
-extern long charwidth(XftFont*, Rune);
+extern int64_t charwidth(XftFont*, Rune);
extern void texture(Bitmap*, Rectangle, Bitmap*, Fcode);
extern void wrbitmap(Bitmap*, int, int, unsigned char*);
extern void rdbitmap(Bitmap*, int, int, unsigned char*);
(DIR) diff --git a/libXg/rune.c b/libXg/rune.c
@@ -31,7 +31,7 @@ int
chartorune(Rune *rune, char *str)
{
int c, c1, c2;
- long l;
+ int64_t l;
/*
* one character sequence
@@ -86,7 +86,7 @@ bad:
int
runetochar(char *str, Rune *rune)
{
- long c;
+ int64_t c;
/*
* one character sequence
@@ -119,7 +119,7 @@ runetochar(char *str, Rune *rune)
}
int
-runelen(long c)
+runelen(int64_t c)
{
Rune rune;
char str[10];
@@ -164,9 +164,9 @@ fullrune(char *str, int n)
}
char*
-utfrune(char *s, long c)
+utfrune(char *s, int64_t c)
{
- long c1;
+ int64_t c1;
Rune r;
int n;
@@ -195,7 +195,7 @@ int
utflen(char *s)
{
int c;
- long n;
+ int64_t n;
Rune rune;
n = 0;
(DIR) diff --git a/sam/cmd.c b/sam/cmd.c
@@ -232,7 +232,7 @@ newcmd(void){
Cmd *p;
p = emalloc(sizeof(Cmd));
- inslist(&cmdlist, cmdlist.nused, (long)p);
+ inslist(&cmdlist, cmdlist.nused, (int64_t)p);
return p;
}
@@ -242,7 +242,7 @@ newaddr(void)
Addr *p;
p = emalloc(sizeof(Addr));
- inslist(&addrlist, addrlist.nused, (long)p);
+ inslist(&addrlist, addrlist.nused, (int64_t)p);
return p;
}
@@ -252,7 +252,7 @@ newre(void)
String *p;
p = emalloc(sizeof(String));
- inslist(&relist, relist.nused, (long)p);
+ inslist(&relist, relist.nused, (int64_t)p);
Strinit(p);
return p;
}
@@ -263,7 +263,7 @@ newstring(void)
String *p;
p = emalloc(sizeof(String));
- inslist(&stringlist, stringlist.nused, (long)p);
+ inslist(&stringlist, stringlist.nused, (int64_t)p);
Strinit(p);
return p;
}
(DIR) diff --git a/sam/file.c b/sam/file.c
@@ -402,7 +402,7 @@ puthdr_cll(Buffer *b, char c, Posn p1, Posn p2)
Binsert(b, ftempstr((Rune*)&buf, sizeof buf/RUNESIZE), b->nrunes);
}
-long
+int64_t
Fchars(File *f, Rune *addr, Posn p1, Posn p2)
{
return Bread(f->buf, addr, p2-p1, p1);
(DIR) diff --git a/sam/io.c b/sam/io.c
@@ -28,7 +28,7 @@ writef(File *f)
char *name;
int i, samename, newfile;
uint64_t dev, qid;
- long mtime, appendonly, length;
+ int64_t mtime, appendonly, length;
newfile = 0;
samename = Strcmp(&genstr, &f->name) == 0;
@@ -78,7 +78,7 @@ readio(File *f, int *nulls, int setdate)
Posn nt;
Posn p = addr.r.p2;
uint64_t dev, qid;
- long mtime;
+ int64_t mtime;
char buf[BLOCKSIZE+1], *s;
*nulls = FALSE;
(DIR) diff --git a/sam/list.c b/sam/list.c
@@ -9,11 +9,11 @@ growlist(List *l)
{
if(l->listptr==0 || l->nalloc==0){
l->nalloc = INCR;
- l->listptr = emalloc(INCR*sizeof(long));
+ l->listptr = emalloc(INCR*sizeof(int64_t));
l->nused = 0;
}else if(l->nused == l->nalloc){
- l->listptr = erealloc(l->listptr, (l->nalloc+INCR)*sizeof(long));
- memset((void*)(l->longptr+l->nalloc), 0, INCR*sizeof(long));
+ l->listptr = erealloc(l->listptr, (l->nalloc+INCR)*sizeof(int64_t));
+ memset((void*)(l->longptr+l->nalloc), 0, INCR*sizeof(int64_t));
l->nalloc += INCR;
}
}
@@ -24,7 +24,7 @@ growlist(List *l)
void
dellist(List *l, int i)
{
- memmove(&l->longptr[i], &l->longptr[i+1], (l->nused-(i+1))*sizeof(long));
+ memmove(&l->longptr[i], &l->longptr[i+1], (l->nused-(i+1))*sizeof(int64_t));
l->nused--;
}
@@ -32,10 +32,10 @@ dellist(List *l, int i)
* Add a new element, whose position is i, to the list
*/
void
-inslist(List *l, int i, long val)
+inslist(List *l, int i, int64_t val)
{
growlist(l);
- memmove(&l->longptr[i+1], &l->longptr[i], (l->nused-i)*sizeof(long));
+ memmove(&l->longptr[i+1], &l->longptr[i], (l->nused-i)*sizeof(int64_t));
l->longptr[i] = val;
l->nused++;
}
(DIR) diff --git a/sam/mesg.c b/sam/mesg.c
@@ -14,7 +14,7 @@ int waitack;
int noflush;
int tversion;
-long inlong(void);
+int64_t inlong(void);
int inshort(void);
int inmesg(Tmesg);
void setgenstr(File*, Posn, Posn);
@@ -85,10 +85,10 @@ journal(int out, char *s)
}
void
-journaln(int out, long n)
+journaln(int out, int64_t n)
{
char buf[32];
- sprint(buf, sizeof (long) > 4 ? "%ld" : "%d", n);
+ sprint(buf, sizeof (int64_t) > 4 ? "%ld" : "%d", n);
journal(out, buf);
}
#else
@@ -172,7 +172,7 @@ inmesg(Tmesg type)
Rune buf[1025];
int i, m;
short s;
- long l, l1, l2;
+ int64_t l, l1, l2;
File *f;
Posn p0, p1;
Range r;
@@ -465,7 +465,7 @@ inmesg(Tmesg type)
Write(1, c, i);
free(c);
} else
- dprint("snarf buffer too long\n");
+ dprint("snarf buffer too int64_t\n");
break;
case Tsetsnarf:
@@ -523,7 +523,7 @@ inshort(void)
return n;
}
-long
+int64_t
inlong(void)
{
uint64_t n;
@@ -565,7 +565,7 @@ outT0(Hmesg type)
}
void
-outTl(Hmesg type, long l)
+outTl(Hmesg type, int64_t l)
{
outstart(type);
outlong(l);
@@ -694,7 +694,7 @@ outshort(int s)
}
void
-outlong(long l)
+outlong(int64_t l)
{
*outp++ = l;
*outp++ = l>>8;
(DIR) diff --git a/sam/moveto.c b/sam/moveto.c
@@ -35,7 +35,7 @@ tellpat(void)
#define CHARSHIFT 128
void
-lookorigin(File *f, Posn p0, Posn ls, long rl)
+lookorigin(File *f, Posn p0, Posn ls, int64_t rl)
{
int nl, nc, c;
Posn oldp0;
(DIR) diff --git a/sam/multi.c b/sam/multi.c
@@ -11,7 +11,7 @@ newfile(void)
{
File *f;
- inslist(&file, 0, (long)(f = Fopen()));
+ inslist(&file, 0, (int64_t)(f = Fopen()));
f->tag = tag++;
if(downloaded)
outTs(Hnewname, f->tag);
@@ -62,7 +62,7 @@ sortname(File *f)
}else if(cmp<0 && (i>0 || cmd==0))
break;
}
- inslist(&file, i, (long)f);
+ inslist(&file, i, (int64_t)f);
if(downloaded)
outTsS(Hmovname, f->tag, &f->name);
}
(DIR) diff --git a/sam/regexp.c b/sam/regexp.c
@@ -11,7 +11,7 @@ typedef struct Inst Inst;
struct Inst
{
- long type; /* < 0x10000 ==> literal, otherwise action */
+ int64_t type; /* < 0x10000 ==> literal, otherwise action */
union {
int rsubid;
int class;
@@ -447,7 +447,7 @@ lex(void){
return c;
}
-long
+int64_t
nextrec(void){
if(exprp[0]==0 || (exprp[0]=='\\' && exprp[1]==0))
regerror(Ebadclass);
@@ -465,7 +465,7 @@ nextrec(void){
void
bldcclass(void)
{
- long c1, c2, n, na;
+ int64_t c1, c2, n, na;
Rune *classp;
classp = emalloc(DCLASS*RUNESIZE);
(DIR) diff --git a/sam/sam.c b/sam/sam.c
@@ -528,7 +528,7 @@ loadflist(String *s)
;
if((c==' ' || c=='\t') && s->s[i]!='\n'){
if(s->s[i]=='<'){
- Strdelete(s, 0L, (long)i+1);
+ Strdelete(s, 0L, (int64_t)i+1);
readcmd(s);
}else{
Strzero(&genstr);
(DIR) diff --git a/sam/sam.h b/sam/sam.h
@@ -20,7 +20,7 @@
#define INCR 25
#define STRSIZE (2*BLOCKSIZE)
-typedef long Posn; /* file position or address */
+typedef int64_t Posn; /* file position or address */
typedef ushort Mod; /* modification number */
typedef struct Address Address;
@@ -59,18 +59,18 @@ struct Address
File *f;
};
-struct List /* code depends on a long being able to hold a pointer */
+struct List /* code depends on a int64_t being able to hold a pointer */
{
int nalloc;
int nused;
union{
void *listp;
Block *blkp;
- long *longp;
+ int64_t *longp;
uchar* *ucharp;
String* *stringp;
File* *filep;
- long listv;
+ int64_t listv;
}g;
};
@@ -83,7 +83,7 @@ struct List /* code depends on a long being able to hold a pointer */
#define listval g.listv
/*
- * Block must fit in a long because the list routines manage arrays of
+ * Block must fit in a int64_t because the list routines manage arrays of
* blocks. Two problems: some machines (e.g. Cray) can't pull this off
* -- on them, use bitfields -- and the ushort bnum limits temp file sizes
* to about 200 megabytes. Advantages: small, simple code and small
@@ -91,21 +91,21 @@ struct List /* code depends on a long being able to hold a pointer */
* bigger is the easiest way.
*
* The necessary conditions are even stronger:
-* sizeof(struct Block)==sizeof(long)
+* sizeof(struct Block)==sizeof(int64_t)
* && the first 32 bits must hold bnum and nrunes.
-* When sizeof(ushort)+sizeof(short) < sizeof(long),
+* When sizeof(ushort)+sizeof(short) < sizeof(int64_t),
* add padding at the beginning on a little endian and at
* the end on a big endian, as shown below for the DEC Alpha.
*/
struct Block
{
#if USE64BITS == 1
- char pad[sizeof(long)-sizeof(ushort)-sizeof(short)];
+ char pad[sizeof(int64_t)-sizeof(ushort)-sizeof(short)];
#endif
ushort bnum; /* absolute number on disk */
short nrunes; /* runes stored in this block */
#if USE64BITS == 2
- char pad[sizeof(long)-sizeof(ushort)-sizeof(short)];
+ char pad[sizeof(int64_t)-sizeof(ushort)-sizeof(short)];
#endif
};
@@ -163,9 +163,9 @@ struct File
char marked; /* file has been Fmarked at least once; once
* set, this will never go off as undo doesn't
* revert to the dawn of time */
- long dev; /* file system from which it was read */
- long qid; /* file from which it was read */
- long date; /* time stamp of plan9 file */
+ int64_t dev; /* file system from which it was read */
+ int64_t qid; /* file from which it was read */
+ int64_t date; /* time stamp of plan9 file */
Posn cp1, cp2; /* Write-behind cache positions and */
String cache; /* string */
Rune getcbuf[NGETC];
@@ -193,7 +193,7 @@ union Hdr
{
short c;
short s;
- long l;
+ int64_t l;
}csl;
struct _cs
{
@@ -203,8 +203,8 @@ union Hdr
struct _cll
{
short c;
- long l;
- long l1;
+ int64_t l;
+ int64_t l1;
}cll;
Mark mark;
};
@@ -228,7 +228,7 @@ int Dread(Disc*, Rune*, int, Posn);
void Dreplace(Disc*, Posn, Posn, Rune*, int);
int Fbgetcload(File*, Posn);
int Fbgetcset(File*, Posn);
-long Fchars(File*, Rune*, Posn, Posn);
+int64_t Fchars(File*, Rune*, Posn, Posn);
void Fclose(File*);
void Fdelete(File*, Posn, Posn);
int Fgetcload(File*, Posn);
@@ -239,7 +239,7 @@ void Fsetname(File*, String*);
void Fstart(void);
int Fupdate(File*, int, int);
int Read(int, void*, int);
-void Seek(int, long, int);
+void Seek(int, int64_t, int);
int plan9(File*, int, String*, int);
int Write(int, void*, int);
int bexecute(File*, Posn);
@@ -267,14 +267,14 @@ int filematch(File*, String*);
void filename(File*);
File *getfile(String*);
int getname(File*, String*, int);
-long getnum(void);
+int64_t getnum(void);
void hiccough(char*);
-void inslist(List*, int, long);
+void inslist(List*, int, int64_t);
Address lineaddr(Posn, Address, int);
void listfree(List*);
void load(File*);
File *lookfile(String*, int);
-void lookorigin(File*, Posn, Posn, long);
+void lookorigin(File*, Posn, Posn, int64_t);
int lookup(int);
void move(File*, Address);
void moveto(File*, Range);
@@ -301,8 +301,8 @@ void snarf(File*, Posn, Posn, Buffer*, int);
void sortname(File*);
void startup(char*, int, char**, char**);
void state(File*, int);
-int statfd(int, uint64_t*, uint64_t*, long*, long*, long*);
-int statfile(char*, uint64_t*, uint64_t*, long*, long*, long*);
+int statfd(int, uint64_t*, uint64_t*, int64_t*, int64_t*, int64_t*);
+int statfile(char*, uint64_t*, uint64_t*, int64_t*, int64_t*, int64_t*);
void Straddc(String*, int);
void Strclose(String*);
int Strcmp(String*, String*);
@@ -383,17 +383,17 @@ extern int noflush;
void outTs(Hmesg, int);
void outT0(Hmesg);
-void outTl(Hmesg, long);
-void outTslS(Hmesg, int, long, String*);
+void outTl(Hmesg, int64_t);
+void outTslS(Hmesg, int, int64_t, String*);
void outTS(Hmesg, String*);
void outTsS(Hmesg, int, String*);
-void outTsllS(Hmesg, int, long, long, String*);
-void outTsll(Hmesg, int, long, long);
-void outTsl(Hmesg, int, long);
-void outTsv(Hmesg, int, long);
+void outTsllS(Hmesg, int, int64_t, int64_t, String*);
+void outTsll(Hmesg, int, int64_t, int64_t);
+void outTsl(Hmesg, int, int64_t);
+void outTsv(Hmesg, int, int64_t);
void outstart(Hmesg);
void outcopy(int, void*);
void outshort(int);
-void outlong(long);
+void outlong(int64_t);
void outsend(void);
void outflush(void);
(DIR) diff --git a/sam/shell.c b/sam/shell.c
@@ -14,7 +14,7 @@ void checkerrs(void);
int
plan9(File *f, int type, String *s, int nest)
{
- long l;
+ int64_t l;
int m;
int pid, fd;
int retcode;
@@ -137,7 +137,7 @@ checkerrs(void)
char buf[256];
int f, n, nl;
char *p;
- long l;
+ int64_t l;
if(statfile(errfile, 0, 0, 0, &l, 0) > 0 && l != 0){
if((f=open((char *)errfile, 0)) != -1){
(DIR) diff --git a/sam/sys.c b/sam/sys.c
@@ -54,7 +54,7 @@ Write(int f, void *a, int n)
}
void
-Seek(int f, long n, int w)
+Seek(int f, int64_t n, int w)
{
if(seek(f, n, w)==-1)
syserror("seek");
(DIR) diff --git a/sam/unix.c b/sam/unix.c
@@ -57,7 +57,7 @@ print_s(char *s, String *a)
}
int
-statfile(char *name, uint64_t *dev, uint64_t *id, long *time, long *length, long *appendonly)
+statfile(char *name, uint64_t *dev, uint64_t *id, int64_t *time, int64_t *length, int64_t *appendonly)
{
struct stat dirb;
@@ -77,7 +77,7 @@ statfile(char *name, uint64_t *dev, uint64_t *id, long *time, long *length, long
}
int
-statfd(int fd, uint64_t *dev, uint64_t *id, long *time, long *length, long *appendonly)
+statfd(int fd, uint64_t *dev, uint64_t *id, int64_t *time, int64_t *length, int64_t *appendonly)
{
struct stat dirb;
(DIR) diff --git a/samterm/flayer.c b/samterm/flayer.c
@@ -30,7 +30,7 @@ flstart(Rectangle r)
}
void
-flnew(Flayer *l, Rune *(*fn)(Flayer*, long, uint64_t*), int u0, void *u1)
+flnew(Flayer *l, Rune *(*fn)(Flayer*, int64_t, uint64_t*), int u0, void *u1)
{
if(nllist == nlalloc){
nlalloc += DELTA;
@@ -207,7 +207,7 @@ lldelete(Flayer *l)
}
void
-flinsert(Flayer *l, Rune *sp, Rune *ep, long p0)
+flinsert(Flayer *l, Rune *sp, Rune *ep, int64_t p0)
{
if(flprepare(l)){
frinsert(&l->f, sp, ep, p0-l->origin);
@@ -218,7 +218,7 @@ flinsert(Flayer *l, Rune *sp, Rune *ep, long p0)
}
void
-fldelete(Flayer *l, long p0, long p1)
+fldelete(Flayer *l, int64_t p0, int64_t p1)
{
if(flprepare(l)){
p0 -= l->origin;
@@ -260,7 +260,7 @@ flselect(Flayer *l)
}
void
-flsetselect(Flayer *l, long p0, long p1)
+flsetselect(Flayer *l, int64_t p0, int64_t p1)
{
uint64_t fp0, fp1;
@@ -283,7 +283,7 @@ flsetselect(Flayer *l, long p0, long p1)
void
flfp0p1(Flayer *l, uint64_t *pp0, uint64_t *pp1)
{
- long p0 = l->p0-l->origin, p1 = l->p1-l->origin;
+ int64_t p0 = l->p0-l->origin, p1 = l->p1-l->origin;
if(p0 < 0)
p0 = 0;
(DIR) diff --git a/samterm/flayer.h b/samterm/flayer.h
@@ -19,10 +19,10 @@ struct Flayer
{
uint64_t bg;
Frame f;
- long origin; /* offset of first char in flayer */
- long p0, p1;
- long click; /* time at which selection click occurred, in HZ */
- Rune *(*textfn)(Flayer*, long, uint64_t*);
+ int64_t origin; /* offset of first char in flayer */
+ int64_t p0, p1;
+ int64_t click; /* time at which selection click occurred, in HZ */
+ Rune *(*textfn)(Flayer*, int64_t, uint64_t*);
int user0;
void *user1;
Rectangle entire;
@@ -32,17 +32,17 @@ struct Flayer
void flborder(Flayer*, int);
void flclose(Flayer*);
-void fldelete(Flayer*, long, long);
+void fldelete(Flayer*, int64_t, int64_t);
void flfp0p1(Flayer*, uint64_t*, uint64_t*);
void flinit(Flayer*, Rectangle, XftFont*, uint64_t bg);
-void flinsert(Flayer*, Rune*, Rune*, long);
-void flnew(Flayer*, Rune *(*fn)(Flayer*, long, uint64_t*), int, void*);
+void flinsert(Flayer*, Rune*, Rune*, int64_t);
+void flnew(Flayer*, Rune *(*fn)(Flayer*, int64_t, uint64_t*), int, void*);
int flprepare(Flayer*);
Rectangle flrect(Flayer*, Rectangle);
void flrefresh(Flayer*, Rectangle, int);
void flreshape(Rectangle);
int flselect(Flayer*);
-void flsetselect(Flayer*, long, long);
+void flsetselect(Flayer*, int64_t, int64_t);
void flstart(Rectangle);
void flupfront(Flayer*);
Flayer *flwhich(Point);
(DIR) diff --git a/samterm/main.c b/samterm/main.c
@@ -9,22 +9,22 @@
#include "samterm.h"
extern uint64_t _bgpixel;
-extern void hmoveto(int, long, Flayer *);
+extern void hmoveto(int, int64_t, Flayer *);
Text cmd;
Rune *scratch;
-long nscralloc;
+int64_t nscralloc;
extern Bitmap screen;
unsigned int cursor;
Mouse mouse;
Flayer *which = NULL;
Flayer *flast = NULL;
Flayer *work = NULL;
-long snarflen;
-long typestart = -1;
-long typeend = -1;
-long typeesc = -1;
-long modified = 0; /* strange lookahead for menus */
+int64_t snarflen;
+int64_t typestart = -1;
+int64_t typeend = -1;
+int64_t typeesc = -1;
+int64_t modified = 0; /* strange lookahead for menus */
char lock = 1;
char hasunlocked = 0;
int expandtabs = 0;
@@ -300,7 +300,7 @@ snarf(Text *t, int w)
void
cut(Text *t, int w, int save, int check)
{
- long p0, p1;
+ int64_t p0, p1;
Flayer *l;
l = &t->l[w];
@@ -331,7 +331,7 @@ paste(Text *t, int w)
}
void
-scrorigin(Flayer *l, int but, long p0)
+scrorigin(Flayer *l, int but, int64_t p0)
{
Text *t=(Text *)l->user1;
@@ -365,7 +365,7 @@ alnum(int c)
}
int
-raspc(Rasp *r, long p)
+raspc(Rasp *r, int64_t p)
{
uint64_t n;
rload(r, p, p+1, &n);
@@ -374,8 +374,8 @@ raspc(Rasp *r, long p)
return 0;
}
-long
-ctlw(Rasp *r, long o, long p)
+int64_t
+ctlw(Rasp *r, int64_t o, int64_t p)
{
int c;
@@ -391,8 +391,8 @@ ctlw(Rasp *r, long o, long p)
return p>=o? p : o;
}
-long
-ctlu(Rasp *r, long o, long p)
+int64_t
+ctlu(Rasp *r, int64_t o, int64_t p)
{
for(; p-1>=o && raspc(r, p-1)!='\n'; --p)
;
@@ -400,7 +400,7 @@ ctlu(Rasp *r, long o, long p)
}
int
-center(Flayer *l, long a)
+center(Flayer *l, int64_t a)
{
Text *t = l->user1;
@@ -414,11 +414,11 @@ center(Flayer *l, long a)
}
int
-onethird(Flayer *l, long a)
+onethird(Flayer *l, int64_t a)
{
Text *t;
Rectangle s;
- long lines;
+ int64_t lines;
t = l->user1;
if(!t->lock && (a<l->origin || l->origin+l->f.nchars<a)){
@@ -467,24 +467,24 @@ flushtyping(int clearesc)
XFlush(_dpy);
}
-static long
-cmdscrolldown(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdscrolldown(Flayer *l, int64_t a, Text *t, const char *arg)
{
flushtyping(0);
center(l, l->origin + l->f.nchars + 1);
return a;
}
-static long
-cmdscrollup(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdscrollup(Flayer *l, int64_t a, Text *t, const char *arg)
{
flushtyping(0);
outTslll(Torigin, t->tag, l->origin, l->f.maxlines + 1, getlayer(l, t));
return a;
}
-static long
-cmdcharleft(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdcharleft(Flayer *l, int64_t a, Text *t, const char *arg)
{
flsetselect(l, a, a);
flushtyping(0);
@@ -496,8 +496,8 @@ cmdcharleft(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdcharright(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdcharright(Flayer *l, int64_t a, Text *t, const char *arg)
{
flsetselect(l, a, a);
flushtyping(0);
@@ -509,8 +509,8 @@ cmdcharright(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdeol(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdeol(Flayer *l, int64_t a, Text *t, const char *arg)
{
flsetselect(l, a, a);
flushtyping(1);
@@ -526,8 +526,8 @@ cmdeol(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdbol(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdbol(Flayer *l, int64_t a, Text *t, const char *arg)
{
flsetselect(l, a, a);
flushtyping(1);
@@ -544,21 +544,21 @@ cmdbol(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdscrollupline(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdscrollupline(Flayer *l, int64_t a, Text *t, const char *arg)
{
if (l->origin > 0)
hmoveto(t->tag, l->origin - 1, l);
return a;
}
-static long
-cmdscrolldownline(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdscrolldownline(Flayer *l, int64_t a, Text *t, const char *arg)
{
- long e = t->rasp.nrunes;
+ int64_t e = t->rasp.nrunes;
if (l->origin + l->f.nchars < e){
- long x = l->origin;
+ int64_t x = l->origin;
while (x + l->f.nchars < e && raspc(&t->rasp, x) != '\n')
x++;
@@ -567,13 +567,13 @@ cmdscrolldownline(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdlineup(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdlineup(Flayer *l, int64_t a, Text *t, const char *arg)
{
flsetselect(l, a, a);
flushtyping(1);
if (a > 0){
- long n0, n1, count = 0;
+ int64_t n0, n1, count = 0;
while (a > 0 && raspc(&t->rasp, a - 1) != '\n'){
a--;
count++;
@@ -594,13 +594,13 @@ cmdlineup(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdlinedown(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdlinedown(Flayer *l, int64_t a, Text *t, const char *arg)
{
flsetselect(l, a, a);
flushtyping(1);
if (a < t->rasp.nrunes){
- long p0, count = 0;
+ int64_t p0, count = 0;
p0 = a;
while (a > 0 && raspc(&t->rasp, a - 1) != '\n'){
@@ -628,8 +628,8 @@ cmdlinedown(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdjump(Flayer *l, long a, Text *u, const char *arg)
+static int64_t
+cmdjump(Flayer *l, int64_t a, Text *u, const char *arg)
{
Text *t = NULL;
@@ -648,16 +648,16 @@ cmdjump(Flayer *l, long a, Text *u, const char *arg)
return a;
}
-static long
-cmdlook(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdlook(Flayer *l, int64_t a, Text *t, const char *arg)
{
outTsll(Tlook, t->tag, which->p0, which->p1);
setlock();
return a;
}
-static long
-cmdsearch(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdsearch(Flayer *l, int64_t a, Text *t, const char *arg)
{
if (t != &cmd && haspat()){
outcmd();
@@ -667,8 +667,8 @@ cmdsearch(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdwrite(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdwrite(Flayer *l, int64_t a, Text *t, const char *arg)
{
cursorswitch(BullseyeCursor);
if (t != &cmd){
@@ -679,8 +679,8 @@ cmdwrite(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdescape(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdescape(Flayer *l, int64_t a, Text *t, const char *arg)
{
if (typeesc >= 0){
l->p0 = typeesc;
@@ -695,8 +695,8 @@ cmdescape(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmddelword(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmddelword(Flayer *l, int64_t a, Text *t, const char *arg)
{
if (l->f.p0 > 0 && a > 0)
l->p0 = ctlw(&t->rasp, l->origin, a);
@@ -717,8 +717,8 @@ cmddelword(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmddelbol(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmddelbol(Flayer *l, int64_t a, Text *t, const char *arg)
{
if (l->f.p0 > 0 && a > 0)
l->p0 = ctlu(&t->rasp, l->origin, a);
@@ -739,8 +739,8 @@ cmddelbol(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmddelbs(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmddelbs(Flayer *l, int64_t a, Text *t, const char *arg)
{
if (l->f.p0 > 0 && a > 0)
l->p0 = a - 1;
@@ -761,8 +761,8 @@ cmddelbs(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmddel(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmddel(Flayer *l, int64_t a, Text *t, const char *arg)
{
l->p0 = a;
if (a < t->rasp.nrunes)
@@ -793,8 +793,8 @@ getlayer(const Flayer *l, const Text *t)
return -1;
}
-static long
-cmdexchange(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdexchange(Flayer *l, int64_t a, Text *t, const char *arg)
{
int w = getlayer(l, t);
if (w >= 0){
@@ -806,8 +806,8 @@ cmdexchange(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdsnarf(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdsnarf(Flayer *l, int64_t a, Text *t, const char *arg)
{
flushtyping(0);
@@ -818,8 +818,8 @@ cmdsnarf(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdcut(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdcut(Flayer *l, int64_t a, Text *t, const char *arg)
{
flushtyping(0);
@@ -830,8 +830,8 @@ cmdcut(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdpaste(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdpaste(Flayer *l, int64_t a, Text *t, const char *arg)
{
flushtyping(0);
@@ -842,8 +842,8 @@ cmdpaste(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdtab(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdtab(Flayer *l, int64_t a, Text *t, const char *arg)
{
flushtyping(0);
@@ -863,8 +863,8 @@ cmdtab(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdsend(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdsend(Flayer *l, int64_t a, Text *t, const char *arg)
{
bool dojump = (t != &cmd);
@@ -887,13 +887,13 @@ cmdsend(Flayer *l, long a, Text *t, const char *arg)
return a;
}
-static long
-cmdnone(Flayer *l, long a, Text *t, const char *arg)
+static int64_t
+cmdnone(Flayer *l, int64_t a, Text *t, const char *arg)
{
return a;
}
-typedef long (*Commandfunc)(Flayer *, long, Text *, const char *);
+typedef int64_t (*Commandfunc)(Flayer *, int64_t, Text *, const char *);
typedef struct CommandEntry CommandEntry;
struct CommandEntry{
Commandfunc f;
@@ -938,7 +938,7 @@ type(Flayer *l) /* what a bloody mess this is -- but it's getting better! */
Rune buf[100];
Keystroke k = {0};
Rune *p = buf;
- long a;
+ int64_t a;
if(lock || t->lock){
kbdblock();
@@ -1029,7 +1029,7 @@ panic(char *s)
}
Rune*
-stgettext(Flayer *l, long n, uint64_t *np)
+stgettext(Flayer *l, int64_t n, uint64_t *np)
{
Text *t;
@@ -1038,7 +1038,7 @@ stgettext(Flayer *l, long n, uint64_t *np)
return scratch;
}
-long
+int64_t
scrtotal(Flayer *l)
{
return ((Text *)l->user1)->rasp.nrunes;
(DIR) diff --git a/samterm/mesg.c b/samterm/mesg.c
@@ -19,9 +19,9 @@ int hversion;
void inmesg(Hmesg, int);
int inshort(int);
-long inlong(int);
-void hsetdot(int, long, long);
-void hmoveto(int, long, Flayer *);
+int64_t inlong(int);
+void hsetdot(int, int64_t, int64_t);
+void hmoveto(int, int64_t, Flayer *);
void hsetsnarf(int);
void clrlock(void);
int snarfswap(char*, int, char**);
@@ -95,7 +95,7 @@ inmesg(Hmesg type, int count)
{
Text *t;
int i, m;
- long l, l2;
+ int64_t l, l2;
Flayer *lp;
m = inshort(0);
@@ -335,7 +335,7 @@ clrlock(void)
void
startfile(Text *t)
{
- outTsl(Tstartfile, t->tag, (long)t); /* for 64-bit pointers */
+ outTsl(Tstartfile, t->tag, (int64_t)t); /* for 64-bit pointers */
setlock();
}
@@ -343,7 +343,7 @@ void
startnewfile(int type, Text *t)
{
t->tag = Untagged;
- outTl(type, (long)t); /* for 64-bit pointers */
+ outTl(type, (int64_t)t); /* for 64-bit pointers */
}
int
@@ -352,10 +352,10 @@ inshort(int n)
return indata[n]|(indata[n+1]<<8);
}
-long
+int64_t
inlong(int n)
{
- long l;
+ int64_t l;
l = (indata[n+7]<<24) | (indata[n+6]<<16) | (indata[n+5]<<8) | indata[n+4];
l = (l<<16) | (indata[n+3]<<8) | indata[n+2];
@@ -371,7 +371,7 @@ outT0(Tmesg type)
}
void
-outTl(Tmesg type, long l)
+outTl(Tmesg type, int64_t l)
{
outstart(type);
outlong(l);
@@ -396,7 +396,7 @@ outTss(Tmesg type, int s1, int s2)
}
void
-outTslll(Tmesg type, int s1, long l1, long l2, long l3)
+outTslll(Tmesg type, int s1, int64_t l1, int64_t l2, int64_t l3)
{
outstart(type);
outshort(s1);
@@ -407,7 +407,7 @@ outTslll(Tmesg type, int s1, long l1, long l2, long l3)
}
void
-outTsll(Tmesg type, int s1, long l1, long l2)
+outTsll(Tmesg type, int s1, int64_t l1, int64_t l2)
{
outstart(type);
outshort(s1);
@@ -417,7 +417,7 @@ outTsll(Tmesg type, int s1, long l1, long l2)
}
void
-outTsl(Tmesg type, int s1, long l1)
+outTsl(Tmesg type, int s1, int64_t l1)
{
outstart(type);
outshort(s1);
@@ -426,7 +426,7 @@ outTsl(Tmesg type, int s1, long l1)
}
void
-outTslS(Tmesg type, int s1, long l1, Rune *s)
+outTslS(Tmesg type, int s1, int64_t l1, Rune *s)
{
char buf[DATASIZE*3+1];
char *c;
@@ -443,7 +443,7 @@ outTslS(Tmesg type, int s1, long l1, Rune *s)
}
void
-outTsls(Tmesg type, int s1, long l1, int s2)
+outTsls(Tmesg type, int s1, int64_t l1, int s2)
{
outstart(type);
outshort(s1);
@@ -477,7 +477,7 @@ outshort(int s)
}
void
-outlong(long l)
+outlong(int64_t l)
{
int i;
uchar buf[8];
@@ -501,7 +501,7 @@ outsend(void)
void
-hsetdot(int m, long p0, long p1)
+hsetdot(int m, int64_t p0, int64_t p1)
{
Text *t = whichtext(m);
Flayer *l = &t->l[t->front];
@@ -511,11 +511,11 @@ hsetdot(int m, long p0, long p1)
}
void
-horigin(int m, long p0, Flayer *l)
+horigin(int m, int64_t p0, Flayer *l)
{
Text *t = whichtext(m);
l = l ? l : &t->l[t->front];
- long a;
+ int64_t a;
uint64_t n;
Rune *r;
@@ -542,7 +542,7 @@ horigin(int m, long p0, Flayer *l)
}
void
-hmoveto(int m, long p0, Flayer *l)
+hmoveto(int m, int64_t p0, Flayer *l)
{
Text *t = whichtext(m);
l = l ? l : &t->l[t->front];
@@ -557,7 +557,7 @@ hcheck(int m)
Flayer *l;
Text *t;
int reqd = 0, i;
- long n, nl, a;
+ int64_t n, nl, a;
Rune *r;
if(m == Untagged)
@@ -651,12 +651,12 @@ hsetsnarf(int nc)
}
void
-hgrow(int m, long a, long new, int req)
+hgrow(int m, int64_t a, int64_t new, int req)
{
int i;
Flayer *l;
Text *t = whichtext(m);
- long o, b;
+ int64_t o, b;
if(new <= 0)
panic("hgrow");
@@ -685,11 +685,11 @@ hgrow(int m, long a, long new, int req)
}
int
-hdata1(Text *t, long a, Rune *r, int len)
+hdata1(Text *t, int64_t a, Rune *r, int len)
{
int i;
Flayer *l;
- long o, b;
+ int64_t o, b;
for(l = &t->l[0], i=0; i<NL; i++, l++){
if(l->textfn==0)
@@ -707,7 +707,7 @@ hdata1(Text *t, long a, Rune *r, int len)
}
int
-hdata(int m, long a, uchar *s, int len)
+hdata(int m, int64_t a, uchar *s, int len)
{
int i, w;
Text *t = whichtext(m);
@@ -724,7 +724,7 @@ hdata(int m, long a, uchar *s, int len)
}
int
-hdatarune(int m, long a, Rune *r, int len)
+hdatarune(int m, int64_t a, Rune *r, int len)
{
Text *t = whichtext(m);
@@ -736,12 +736,12 @@ hdatarune(int m, long a, Rune *r, int len)
}
void
-hcut(int m, long a, long old)
+hcut(int m, int64_t a, int64_t old)
{
Flayer *l;
Text *t = whichtext(m);
int i;
- long o, b;
+ int64_t o, b;
if(t->lock)
--t->lock;
(DIR) diff --git a/samterm/rasp.c b/samterm/rasp.c
@@ -78,7 +78,7 @@ rsdelete(Rasp *r, Section *s)
}
void
-splitsect(Rasp *r, Section *s, long n0)
+splitsect(Rasp *r, Section *s, int64_t n0)
{
if(s == 0)
panic("splitsect");
@@ -95,7 +95,7 @@ splitsect(Rasp *r, Section *s, long n0)
}
Section *
-findsect(Rasp *r, Section *s, long p, long q) /* find sect containing q and put q on a sect boundary */
+findsect(Rasp *r, Section *s, int64_t p, int64_t q) /* find sect containing q and put q on a sect boundary */
{
if(s==0 && p!=q)
panic("findsect");
@@ -109,7 +109,7 @@ findsect(Rasp *r, Section *s, long p, long q) /* find sect containing q and pu
}
void
-rresize(Rasp *r, long a, long old, long new)
+rresize(Rasp *r, int64_t a, int64_t old, int64_t new)
{
Section *s, *t, *ns;
@@ -129,7 +129,7 @@ rresize(Rasp *r, long a, long old, long new)
}
void
-rdata(Rasp *r, long p0, long p1, Rune *cp)
+rdata(Rasp *r, int64_t p0, int64_t p1, Rune *cp)
{
Section *s, *t, *ns;
@@ -176,7 +176,7 @@ Rune*
rload(Rasp *r, uint64_t p0, uint64_t p1, uint64_t *nrp)
{
Section *s;
- long p;
+ int64_t p;
int n, nb;
nb = 0;
@@ -212,7 +212,7 @@ int
rmissing(Rasp *r, uint64_t p0, uint64_t p1)
{
Section *s;
- long p;
+ int64_t p;
int n, nm=0;
for(p=0,s=r->sect; s && p+s->nrunes<=p0; s=s->next)
@@ -235,7 +235,7 @@ int
rcontig(Rasp *r, uint64_t p0, uint64_t p1, int text)
{
Section *s;
- long p, n;
+ int64_t p, n;
int np=0;
for(p=0,s=r->sect; s && p+s->nrunes<=p0; s=s->next)
@@ -253,7 +253,7 @@ rcontig(Rasp *r, uint64_t p0, uint64_t p1, int text)
}
void
-Strgrow(Rune **s, long *n, int want) /* can always toss the old data when called */
+Strgrow(Rune **s, int64_t *n, int want) /* can always toss the old data when called */
{
if(*n >= want)
return;
(DIR) diff --git a/samterm/samterm.h b/samterm/samterm.h
@@ -45,14 +45,14 @@ typedef struct Rasp Rasp;
struct Section
{
- long nrunes;
+ int64_t nrunes;
Rune *text; /* if null, we haven't got it */
Section *next;
};
struct Rasp
{
- long nrunes;
+ int64_t nrunes;
Section *sect;
};
@@ -87,14 +87,14 @@ extern Flayer *which;
extern Flayer *work;
extern Text cmd;
extern Rune *scratch;
-extern long nscralloc;
+extern int64_t nscralloc;
extern char lock;
extern char hasunlocked;
-extern long snarflen;
+extern int64_t snarflen;
extern Mouse mouse;
-extern long modified;
+extern int64_t modified;
-Rune *stgettext(Flayer*, long, uint64_t*);
+Rune *stgettext(Flayer*, int64_t, uint64_t*);
void *alloc(uint64_t n);
void iconinit(void);
@@ -120,7 +120,7 @@ void mouseexit(void);
void cut(Text*, int, int, int);
void paste(Text*, int);
void snarf(Text*, int);
-int center(Flayer*, long);
+int center(Flayer*, int64_t);
int xmenuhit(int, Menu*);
void buttons(int);
int getr(Rectangle*);
@@ -129,7 +129,7 @@ void duplicate(Flayer*, Rectangle, XftFont*, int);
void startfile(Text*);
void panic(char*);
void closeup(Flayer*);
-void Strgrow(Rune**, long*, int);
+void Strgrow(Rune**, int64_t*, int);
int RESHAPED(void);
void reshape(void);
void rcv(void);
@@ -140,29 +140,29 @@ void scroll(Flayer*, int, int);
void hcheck(int);
void rclear(Rasp*);
int whichmenu(int);
-void hcut(int, long, long);
-void horigin(int, long, Flayer *);
-void hgrow(int, long, long, int);
-int hdata(int, long, uchar*, int);
-int hdatarune(int, long, Rune*, 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 hdatarune(int, int64_t, Rune*, int);
Rune *rload(Rasp*, uint64_t, uint64_t, uint64_t*);
void menuins(int, uchar*, Text*, int, int);
void menudel(int);
Text *sweeptext(int, int);
void setpat(char*);
bool haspat(void);
-void scrdraw(Flayer*, long tot);
+void scrdraw(Flayer*, int64_t tot);
int rcontig(Rasp*, uint64_t, uint64_t, int);
int rmissing(Rasp*, uint64_t, uint64_t);
-void rresize(Rasp *, long, long, long);
-void rdata(Rasp*, long, long, Rune*);
+void rresize(Rasp *, int64_t, int64_t, int64_t);
+void rdata(Rasp*, int64_t, int64_t, Rune*);
void rclean(Rasp*);
-void scrorigin(Flayer*, int, long);
-long scrtotal(Flayer*);
+void scrorigin(Flayer*, int, int64_t);
+int64_t scrtotal(Flayer*);
void flnewlyvisible(Flayer*);
char *rcvstring(void);
void Strcpy(Rune*, Rune*);
-void Strncpy(Rune*, Rune*, long);
+void Strncpy(Rune*, Rune*, int64_t);
void flushtyping(int);
void dumperrmsg(int, int, int, int);
int screensize(int*,int*);
@@ -171,16 +171,16 @@ int screensize(int*,int*);
void outTs(Tmesg, int);
void outT0(Tmesg);
-void outTl(Tmesg, long);
-void outTslS(Tmesg, int, long, Rune*);
-void outTslll(Tmesg, int, long, long, long);
-void outTsll(Tmesg, int, long, long);
-void outTsl(Tmesg, int, long);
+void outTl(Tmesg, int64_t);
+void outTslS(Tmesg, int, int64_t, Rune*);
+void outTslll(Tmesg, int, int64_t, int64_t, int64_t);
+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 outshort(int);
-void outlong(long);
+void outlong(int64_t);
void outsend(void);
int getlayer(const Flayer *l, const Text *t);
void loadrcfile(FILE *);
(DIR) diff --git a/samterm/scroll.c b/samterm/scroll.c
@@ -10,9 +10,9 @@ extern Bitmap *darkgrey;
extern Mouse mouse;
Rectangle
-scrpos(Rectangle r, long p0, long p1, long tot)
+scrpos(Rectangle r, int64_t p0, int64_t p1, int64_t tot)
{
- long h;
+ int64_t h;
Rectangle q;
q = inset(r, 1);
@@ -42,7 +42,7 @@ scrflip(Flayer *l, Rectangle r)
}
void
-scrdraw(Flayer *l, long tot)
+scrdraw(Flayer *l, int64_t tot)
{
Rectangle r, r1, r2;
Bitmap *b;
@@ -79,10 +79,10 @@ void
scroll(Flayer *l, int pbut, int but)
{
int in = 0, oin;
- long tot = scrtotal(l);
+ int64_t tot = scrtotal(l);
Rectangle scr, r, s, rt;
int x, y, my, oy, h;
- long p0;
+ int64_t p0;
s = inset(l->scroll, 1);
x = s.min.x+FLSCROLLWID/2;
@@ -129,7 +129,7 @@ scroll(Flayer *l, int pbut, int but)
scrflip(l, r);
p0 = 0;
if(but == 1)
- p0 = (long)(my-s.min.y)/l->f.fheight+1;
+ p0 = (int64_t)(my-s.min.y)/l->f.fheight+1;
else if(but == 2){
if(tot > 1024L*1024L)
p0 = ((tot>>10)*(y-s.min.y)/h)<<10;