mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
update lucida
This commit is contained in:
parent
7bd7fd2f4f
commit
17157e4aa8
24 changed files with 160 additions and 96 deletions
13
LICENSE
13
LICENSE
|
@ -6,16 +6,9 @@ under simpler BSD-like boilerplates. See the LICENSE files in those
|
||||||
directories. There are other exceptions, also marked with LICENSE files
|
directories. There are other exceptions, also marked with LICENSE files
|
||||||
in their directories.
|
in their directories.
|
||||||
|
|
||||||
The bitmap fonts in the font/lucida directory are copyright B&H Inc. and Y&Y Inc.
|
The bitmap fonts in the font/luc, font/lucm, font/lucsans, and font/pelm
|
||||||
and distributed under the following exception to the Lucent license:
|
directory are copyright B&H Inc. and distributed under more restricted
|
||||||
|
terms under agreement with B&H. See the NOTICE file in those directories.
|
||||||
No right is granted to create derivative works of or
|
|
||||||
to redistribute (other than with the Plan 9 Operating System)
|
|
||||||
the screen imprinter fonts identified in subdirectory
|
|
||||||
font/lucida. This directory contains material copyrights by
|
|
||||||
B&H Inc. and Y&Y Inc.
|
|
||||||
|
|
||||||
(Of course, X11 already distributes non-Unicode versions of these fonts.)
|
|
||||||
|
|
||||||
===================================================================
|
===================================================================
|
||||||
|
|
||||||
|
|
1
bin/9c
1
bin/9c
|
@ -15,6 +15,7 @@ usegcc()
|
||||||
-Wno-sign-compare \
|
-Wno-sign-compare \
|
||||||
-Wno-unknown-pragmas \
|
-Wno-unknown-pragmas \
|
||||||
-fno-omit-frame-pointer \
|
-fno-omit-frame-pointer \
|
||||||
|
-fno-inline-functions-called-once \
|
||||||
"
|
"
|
||||||
# want to put -fno-optimize-sibling-calls here but
|
# want to put -fno-optimize-sibling-calls here but
|
||||||
# that option only works with gcc3+ it seems
|
# that option only works with gcc3+ it seems
|
||||||
|
|
5
dist/deb.html
vendored
5
dist/deb.html
vendored
|
@ -26,6 +26,11 @@ Edit ./^$/,s/<Table/<table border=0 cellspacing=0 cellpadding=0 width=100%/g
|
||||||
<table border=0 cellspacing=0 cellpadding=0 width=100%><tr height=20><td></table>
|
<table border=0 cellspacing=0 cellpadding=0 width=100%><tr height=20><td></table>
|
||||||
|
|
||||||
Here are packages built for the Debian distribution of Linux.
|
Here are packages built for the Debian distribution of Linux.
|
||||||
|
<br>
|
||||||
|
Newer packages can be had by adding
|
||||||
|
<pre>
|
||||||
|
deb http://swtch.com/debian/ testing main</pre> to your
|
||||||
|
<tt>/etc/apt/sources.list</tt>.
|
||||||
|
|
||||||
<table border=0 cellspacing=0 cellpadding=0 width=100%><tr height=10><td></table>
|
<table border=0 cellspacing=0 cellpadding=0 width=100%><tr height=10><td></table>
|
||||||
<table border=0 cellspacing=0 cellpadding=0 width=100%>
|
<table border=0 cellspacing=0 cellpadding=0 width=100%>
|
||||||
|
|
2
dist/mkfilelist
vendored
2
dist/mkfilelist
vendored
|
@ -67,7 +67,7 @@ awk -vplan9'='$PLAN9 '
|
||||||
|
|
||||||
/^font\/(big5|gb|jis|naga10|shinonome)/ { cat("font-asian") }
|
/^font\/(big5|gb|jis|naga10|shinonome)/ { cat("font-asian") }
|
||||||
/^font\/LICENSE/ { cat("font-bh") }
|
/^font\/LICENSE/ { cat("font-bh") }
|
||||||
/^font\/(lucida|lucidasans|lucm|pelm)\// { cat("font-bh") }
|
/^font\/(luc|lucsans|lucm|pelm)\// { cat("font-bh") }
|
||||||
/^font\/(MAP|fixed|misc|sample|smiley)/ { cat("font-core") }
|
/^font\/(MAP|fixed|misc|sample|smiley)/ { cat("font-core") }
|
||||||
/^font\/(palatino|times|special)/ { cat("font-proof") }
|
/^font\/(palatino|times|special)/ { cat("font-proof") }
|
||||||
/^font\// { cat("font-core") }
|
/^font\// { cat("font-core") }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# mkfile rules to get fonts in Lucida Sans.
|
# mkfile rules to set fonts
|
||||||
# if you want to use Times, change these next lines to
|
# if you want to use Times, change these next lines to
|
||||||
# MAN=mantimes
|
# MAN=mantimes
|
||||||
# FONTS=''
|
# FONTS=''
|
||||||
|
|
|
@ -50,6 +50,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
if((image=readimage(display, fd, 0)) == nil)
|
if((image=readimage(display, fd, 0)) == nil)
|
||||||
sysfatal("readimage: %r");
|
sysfatal("readimage: %r");
|
||||||
|
sleep(1000);
|
||||||
|
|
||||||
drawresizewindow(Rect(0,0,Dx(image->r),Dy(image->r)));
|
drawresizewindow(Rect(0,0,Dx(image->r),Dy(image->r)));
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ main(int argc, char **argv)
|
||||||
case Ekeyboard:
|
case Ekeyboard:
|
||||||
if(e.kbdc == 'q' || e.kbdc == 0x7F)
|
if(e.kbdc == 'q' || e.kbdc == 0x7F)
|
||||||
exits(nil);
|
exits(nil);
|
||||||
|
eresized(0);
|
||||||
break;
|
break;
|
||||||
case Emouse:
|
case Emouse:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
@ -71,6 +72,8 @@ static Image* convert(Graphic*);
|
||||||
static Image* gfxdrawpage(Document *d, int page);
|
static Image* gfxdrawpage(Document *d, int page);
|
||||||
static char* gfxpagename(Document*, int);
|
static char* gfxpagename(Document*, int);
|
||||||
static int spawnrc(char*, uchar*, int);
|
static int spawnrc(char*, uchar*, int);
|
||||||
|
static void waitrc(void);
|
||||||
|
static int spawnpost(int);
|
||||||
static int addpage(Document*, char*);
|
static int addpage(Document*, char*);
|
||||||
static int rmpage(Document*, int);
|
static int rmpage(Document*, int);
|
||||||
static int genaddpage(Document*, char*, uchar*, int);
|
static int genaddpage(Document*, char*, uchar*, int);
|
||||||
|
@ -97,6 +100,7 @@ initgfx(Biobuf *b, int argc, char **argv, uchar *buf, int nbuf)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
USED(b);
|
USED(b);
|
||||||
|
|
||||||
doc = emalloc(sizeof(*doc));
|
doc = emalloc(sizeof(*doc));
|
||||||
gfx = emalloc(sizeof(*gfx));
|
gfx = emalloc(sizeof(*gfx));
|
||||||
gfx->g = nil;
|
gfx->g = nil;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
@ -134,7 +135,7 @@ spawnmonitor(int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
spawngs(GSInfo *g)
|
spawngs(GSInfo *g, char *safer)
|
||||||
{
|
{
|
||||||
char *args[16];
|
char *args[16];
|
||||||
char tb[32], gb[32];
|
char tb[32], gb[32];
|
||||||
|
@ -158,7 +159,7 @@ spawngs(GSInfo *g)
|
||||||
nargs = 0;
|
nargs = 0;
|
||||||
args[nargs++] = "gs";
|
args[nargs++] = "gs";
|
||||||
args[nargs++] = "-dNOPAUSE";
|
args[nargs++] = "-dNOPAUSE";
|
||||||
args[nargs++] = "-dSAFER";
|
args[nargs++] = safer;
|
||||||
args[nargs++] = "-sDEVICE=plan9";
|
args[nargs++] = "-sDEVICE=plan9";
|
||||||
args[nargs++] = "-sOutputFile=/fd/3";
|
args[nargs++] = "-sOutputFile=/fd/3";
|
||||||
args[nargs++] = "-dQUIET";
|
args[nargs++] = "-dQUIET";
|
||||||
|
@ -268,14 +269,11 @@ setdim(GSInfo *gs, Rectangle bbox, int ppi, int landscape)
|
||||||
if(!Dx(bbox))
|
if(!Dx(bbox))
|
||||||
bbox = Rect(0, 0, 612, 792); /* 8½×11 */
|
bbox = Rect(0, 0, 612, 792); /* 8½×11 */
|
||||||
|
|
||||||
switch(landscape){
|
if(landscape)
|
||||||
case 0:
|
|
||||||
pbox = bbox;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
pbox = Rect(bbox.min.y, bbox.min.x, bbox.max.y, bbox.max.x);
|
pbox = Rect(bbox.min.y, bbox.min.x, bbox.max.y, bbox.max.x);
|
||||||
break;
|
else
|
||||||
}
|
pbox = bbox;
|
||||||
|
|
||||||
gscmd(gs, "/PageSize [%d %d]\n", Dx(pbox), Dy(pbox));
|
gscmd(gs, "/PageSize [%d %d]\n", Dx(pbox), Dy(pbox));
|
||||||
gscmd(gs, "/Margins [%d %d]\n", -pbox.min.x, -pbox.min.y);
|
gscmd(gs, "/Margins [%d %d]\n", -pbox.min.x, -pbox.min.y);
|
||||||
gscmd(gs, "currentdevice putdeviceprops pop\n");
|
gscmd(gs, "currentdevice putdeviceprops pop\n");
|
||||||
|
|
|
@ -14,7 +14,7 @@ OFILES=\
|
||||||
util.$O\
|
util.$O\
|
||||||
view.$O\
|
view.$O\
|
||||||
|
|
||||||
<$PLAN9/src//mkone
|
<$PLAN9/src/mkone
|
||||||
|
|
||||||
pdfprolog.c: pdfprolog.ps
|
pdfprolog.c: pdfprolog.ps
|
||||||
cat pdfprolog.ps | sed 's/.*/"&\\n"/g' >pdfprolog.c
|
cat pdfprolog.ps | sed 's/.*/"&\\n"/g' >pdfprolog.c
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
@ -19,43 +20,6 @@ int wctlfd = -1;
|
||||||
int stdinfd;
|
int stdinfd;
|
||||||
int truecolor;
|
int truecolor;
|
||||||
int imagemode;
|
int imagemode;
|
||||||
int notewatcher;
|
|
||||||
int notegp;
|
|
||||||
|
|
||||||
int
|
|
||||||
watcher(void *v, char *x)
|
|
||||||
{
|
|
||||||
USED(v);
|
|
||||||
|
|
||||||
if(strcmp(x, "die") != 0)
|
|
||||||
postnote(PNGROUP, notegp, x);
|
|
||||||
_exits(0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
bell(void *u, char *x)
|
|
||||||
{
|
|
||||||
if(x && strcmp(x, "hangup") == 0)
|
|
||||||
_exits(0);
|
|
||||||
|
|
||||||
if(x && strstr(x, "die") == nil)
|
|
||||||
fprint(2, "postnote %d: %s\n", getpid(), x);
|
|
||||||
|
|
||||||
/* alarms come from the gs monitor */
|
|
||||||
if(x && strstr(x, "alarm")){
|
|
||||||
postnote(PNGROUP, getpid(), "die (gs error)");
|
|
||||||
postnote(PNPROC, notewatcher, "die (gs error)");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* function mentions u so that it's in the stack trace */
|
|
||||||
if((u == nil || u != x) && doabort)
|
|
||||||
abort();
|
|
||||||
|
|
||||||
/* fprint(2, "exiting %d\n", getpid()); */
|
|
||||||
wexits("note");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
afmt(Fmt *fmt)
|
afmt(Fmt *fmt)
|
||||||
|
@ -128,23 +92,7 @@ main(int argc, char **argv)
|
||||||
usage();
|
usage();
|
||||||
}ARGEND;
|
}ARGEND;
|
||||||
|
|
||||||
notegp = getpid();
|
|
||||||
|
|
||||||
switch(notewatcher = fork()){
|
|
||||||
case -1:
|
|
||||||
sysfatal("fork\n");
|
|
||||||
exits(0);
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
atnotify(watcher, 1);
|
|
||||||
for(;;)
|
|
||||||
sleep(1000);
|
|
||||||
_exits(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
rfork(RFNOTEG);
|
rfork(RFNOTEG);
|
||||||
atnotify(bell, 1);
|
|
||||||
|
|
||||||
readstdin = 0;
|
readstdin = 0;
|
||||||
if(imagemode == 0 && argc == 0){
|
if(imagemode == 0 && argc == 0){
|
||||||
|
@ -159,6 +107,8 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
fmtinstall('R', Rfmt);
|
fmtinstall('R', Rfmt);
|
||||||
fmtinstall('P', Pfmt);
|
fmtinstall('P', Pfmt);
|
||||||
|
if(mknewwindow)
|
||||||
|
newwin();
|
||||||
|
|
||||||
if(readstdin){
|
if(readstdin){
|
||||||
b = nil;
|
b = nil;
|
||||||
|
@ -229,8 +179,5 @@ main(int argc, char **argv)
|
||||||
void
|
void
|
||||||
wexits(char *s)
|
wexits(char *s)
|
||||||
{
|
{
|
||||||
if(s && *s && strcmp(s, "note") != 0 && mknewwindow)
|
|
||||||
sleep(10*1000);
|
|
||||||
postnote(PNPROC, notewatcher, "die");
|
|
||||||
exits(s);
|
exits(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#include <cursor.h>
|
|
||||||
|
|
||||||
typedef struct Document Document;
|
typedef struct Document Document;
|
||||||
|
|
||||||
struct Document {
|
struct Document {
|
||||||
|
@ -44,6 +42,7 @@ extern int mknewwindow;
|
||||||
|
|
||||||
void rot180(Image*);
|
void rot180(Image*);
|
||||||
Image *rot90(Image*);
|
Image *rot90(Image*);
|
||||||
|
Image *rot270(Image*);
|
||||||
Image *resample(Image*, Image*);
|
Image *resample(Image*, Image*);
|
||||||
|
|
||||||
/* ghostscript interface shared by ps, pdf */
|
/* ghostscript interface shared by ps, pdf */
|
||||||
|
@ -57,7 +56,7 @@ struct GSInfo {
|
||||||
};
|
};
|
||||||
void waitgs(GSInfo*);
|
void waitgs(GSInfo*);
|
||||||
int gscmd(GSInfo*, char*, ...);
|
int gscmd(GSInfo*, char*, ...);
|
||||||
int spawngs(GSInfo*);
|
int spawngs(GSInfo*, char*);
|
||||||
void setdim(GSInfo*, Rectangle, int, int);
|
void setdim(GSInfo*, Rectangle, int, int);
|
||||||
int spawnwriter(GSInfo*, Biobuf*);
|
int spawnwriter(GSInfo*, Biobuf*);
|
||||||
Rectangle screenrect(void);
|
Rectangle screenrect(void);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
@ -97,14 +98,14 @@ initpdf(Biobuf *b, int argc, char **argv, uchar *buf, int nbuf)
|
||||||
d->pagename = pdfpagename;
|
d->pagename = pdfpagename;
|
||||||
d->fwdonly = 0;
|
d->fwdonly = 0;
|
||||||
|
|
||||||
if(spawngs(&pdf->gs) < 0)
|
if(spawngs(&pdf->gs, "-dDELAYSAFER") < 0)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
gscmd(&pdf->gs, "%s", pdfprolog);
|
gscmd(&pdf->gs, "%s", pdfprolog);
|
||||||
waitgs(&pdf->gs);
|
waitgs(&pdf->gs);
|
||||||
|
|
||||||
setdim(&pdf->gs, Rect(0,0,0,0), ppi, 0);
|
setdim(&pdf->gs, Rect(0,0,0,0), ppi, 0);
|
||||||
gscmd(&pdf->gs, "(%s) (r) file pdfopen begin\n", fn);
|
gscmd(&pdf->gs, "(%s) (r) file { DELAYSAFER { .setsafe } if } stopped pop pdfopen begin\n", fn);
|
||||||
gscmd(&pdf->gs, "pdfpagecount PAGE==\n");
|
gscmd(&pdf->gs, "pdfpagecount PAGE==\n");
|
||||||
p = Brdline(&pdf->gs.gsrd, '\n');
|
p = Brdline(&pdf->gs.gsrd, '\n');
|
||||||
npage = atoi(p);
|
npage = atoi(p);
|
||||||
|
@ -121,11 +122,10 @@ initpdf(Biobuf *b, int argc, char **argv, uchar *buf, int nbuf)
|
||||||
pdf->pagebbox = emalloc(sizeof(Rectangle)*npage);
|
pdf->pagebbox = emalloc(sizeof(Rectangle)*npage);
|
||||||
for(i=0; i<npage; i++) {
|
for(i=0; i<npage; i++) {
|
||||||
gscmd(&pdf->gs, "%d pdfgetpage\n", i+1);
|
gscmd(&pdf->gs, "%d pdfgetpage\n", i+1);
|
||||||
pdf->pagebbox[i] = pdfbbox(&pdf->gs);
|
pdf->pagebbox[i] = pdfbbox(pdf);
|
||||||
if(Dx(pdf->pagebbox[i]) <= 0)
|
if(Dx(pdf->pagebbox[i]) <= 0)
|
||||||
pdf->pagebbox[i] = bbox;
|
pdf->pagebbox[i] = bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +149,7 @@ static char*
|
||||||
pdfpagename(Document *d, int page)
|
pdfpagename(Document *d, int page)
|
||||||
{
|
{
|
||||||
static char str[15];
|
static char str[15];
|
||||||
|
|
||||||
USED(d);
|
USED(d);
|
||||||
sprint(str, "p %d", page+1);
|
sprint(str, "p %d", page+1);
|
||||||
return str;
|
return str;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -348,7 +349,7 @@ Keepreading:
|
||||||
d->fwdonly = ps->clueless = dumb;
|
d->fwdonly = ps->clueless = dumb;
|
||||||
d->docname = argv[0];
|
d->docname = argv[0];
|
||||||
|
|
||||||
if(spawngs(&ps->gs) < 0)
|
if(spawngs(&ps->gs, "-dSAFER") < 0)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
if(!cantranslate)
|
if(!cantranslate)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ moveup(Image *im, Image *tmp, int a, int b, int c, int axis)
|
||||||
drawop(tmp, tmp->r, im, nil, im->r.min, S);
|
drawop(tmp, tmp->r, im, nil, im->r.min, S);
|
||||||
|
|
||||||
switch(axis){
|
switch(axis){
|
||||||
|
default:
|
||||||
case Xaxis:
|
case Xaxis:
|
||||||
range = Rect(a, im->r.min.y, c, im->r.max.y);
|
range = Rect(a, im->r.min.y, c, im->r.max.y);
|
||||||
dr0 = range;
|
dr0 = range;
|
||||||
|
@ -88,6 +90,7 @@ interlace(Image *im, Image *tmp, int axis, int n, Image *mask, int gran)
|
||||||
r0 = im->r;
|
r0 = im->r;
|
||||||
r1 = im->r;
|
r1 = im->r;
|
||||||
switch(axis) {
|
switch(axis) {
|
||||||
|
default:
|
||||||
case Xaxis:
|
case Xaxis:
|
||||||
r0.max.x = n;
|
r0.max.x = n;
|
||||||
r1.min.x = n;
|
r1.min.x = n;
|
||||||
|
@ -245,6 +248,31 @@ rot90(Image *im)
|
||||||
return(tmp);
|
return(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* rotates an image 270 degrees clockwise */
|
||||||
|
Image *
|
||||||
|
rot270(Image *im)
|
||||||
|
{
|
||||||
|
Image *tmp;
|
||||||
|
int i, j, dx, dy;
|
||||||
|
|
||||||
|
dx = Dx(im->r);
|
||||||
|
dy = Dy(im->r);
|
||||||
|
tmp = xallocimage(display, Rect(0, 0, dy, dx), im->chan, 0, DCyan);
|
||||||
|
if(tmp == nil) {
|
||||||
|
fprint(2, "out of memory during rot270: %r\n");
|
||||||
|
wexits("memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; i < dy; i++) {
|
||||||
|
for(j = 0; j < dx; j++) {
|
||||||
|
drawop(tmp, Rect(i, j, i+1, j+1), im, nil, Pt(dx-(j+1), i), S);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freeimage(im);
|
||||||
|
|
||||||
|
return(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
/* from resample.c -- resize from → to using interpolation */
|
/* from resample.c -- resize from → to using interpolation */
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,6 +316,7 @@ kaiser(double x, double tau, double alpha)
|
||||||
return i0(alpha*sqrt(1-(x*x/(tau*tau))))/i0(alpha);
|
return i0(alpha*sqrt(1-(x*x/(tau*tau))))/i0(alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
resamplex(uchar *in, int off, int d, int inx, uchar *out, int outx)
|
resamplex(uchar *in, int off, int d, int inx, uchar *out, int outx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include "page.h"
|
#include "page.h"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <draw.h>
|
#include <draw.h>
|
||||||
#include <cursor.h>
|
#include <cursor.h>
|
||||||
|
#include <cursor.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
Document *doc;
|
Document *doc;
|
||||||
Image *im;
|
Image *im;
|
||||||
int page;
|
int page;
|
||||||
int upside = 0;
|
int angle = 0;
|
||||||
int showbottom = 0; /* on the next showpage, move the image so the bottom is visible. */
|
int showbottom = 0; /* on the next showpage, move the image so the bottom is visible. */
|
||||||
|
|
||||||
Rectangle ulrange; /* the upper left corner of the image must be in this rectangle */
|
Rectangle ulrange; /* the upper left corner of the image must be in this rectangle */
|
||||||
|
@ -156,8 +157,17 @@ showpage(int page, Menu *m)
|
||||||
im = tmp;
|
im = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(upside)
|
switch(angle){
|
||||||
|
case 90:
|
||||||
|
im = rot90(im);
|
||||||
|
break;
|
||||||
|
case 180:
|
||||||
rot180(im);
|
rot180(im);
|
||||||
|
break;
|
||||||
|
case 270:
|
||||||
|
im = rot270(im);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
esetcursor(nil);
|
esetcursor(nil);
|
||||||
if(showbottom){
|
if(showbottom){
|
||||||
|
@ -390,7 +400,7 @@ viewer(Document *dd)
|
||||||
esetcursor(&reading);
|
esetcursor(&reading);
|
||||||
rot180(im);
|
rot180(im);
|
||||||
esetcursor(nil);
|
esetcursor(nil);
|
||||||
upside = !upside;
|
angle = (angle+180) % 360;
|
||||||
redraw(screen);
|
redraw(screen);
|
||||||
flushimage(display, 1);
|
flushimage(display, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -589,6 +599,7 @@ viewer(Document *dd)
|
||||||
esetcursor(&reading);
|
esetcursor(&reading);
|
||||||
im = rot90(im);
|
im = rot90(im);
|
||||||
esetcursor(nil);
|
esetcursor(nil);
|
||||||
|
angle = (angle+90) % 360;
|
||||||
redraw(screen);
|
redraw(screen);
|
||||||
flushimage(display, 1);
|
flushimage(display, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -598,7 +609,7 @@ viewer(Document *dd)
|
||||||
esetcursor(&reading);
|
esetcursor(&reading);
|
||||||
rot180(im);
|
rot180(im);
|
||||||
esetcursor(nil);
|
esetcursor(nil);
|
||||||
upside = !upside;
|
angle = (angle+180) % 360;
|
||||||
redraw(screen);
|
redraw(screen);
|
||||||
flushimage(display, 1);
|
flushimage(display, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -978,6 +989,67 @@ rdenv(char *name)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
newwin(void)
|
||||||
|
{
|
||||||
|
char *srv, *mntsrv;
|
||||||
|
char spec[100];
|
||||||
|
int srvfd, cons, pid;
|
||||||
|
|
||||||
|
switch(rfork(RFFDG|RFPROC|RFNAMEG|RFENVG|RFNOTEG|RFNOWAIT)){
|
||||||
|
case -1:
|
||||||
|
fprint(2, "page: can't fork: %r\n");
|
||||||
|
wexits("no fork");
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wexits(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
srv = rdenv("/env/wsys");
|
||||||
|
if(srv == 0){
|
||||||
|
mntsrv = rdenv("/mnt/term/env/wsys");
|
||||||
|
if(mntsrv == 0){
|
||||||
|
fprint(2, "page: can't find $wsys\n");
|
||||||
|
wexits("srv");
|
||||||
|
}
|
||||||
|
srv = malloc(strlen(mntsrv)+10);
|
||||||
|
sprint(srv, "/mnt/term%s", mntsrv);
|
||||||
|
free(mntsrv);
|
||||||
|
pid = 0; /* can't send notes to remote processes! */
|
||||||
|
}else
|
||||||
|
pid = getpid();
|
||||||
|
srvfd = open(srv, ORDWR);
|
||||||
|
free(srv);
|
||||||
|
if(srvfd == -1){
|
||||||
|
fprint(2, "page: can't open %s: %r\n", srv);
|
||||||
|
wexits("no srv");
|
||||||
|
}
|
||||||
|
sprint(spec, "new -pid %d", pid);
|
||||||
|
if(mount(srvfd, -1, "/mnt/wsys", 0, spec) == -1){
|
||||||
|
fprint(2, "page: can't mount /mnt/wsys: %r (spec=%s)\n", spec);
|
||||||
|
wexits("no mount");
|
||||||
|
}
|
||||||
|
close(srvfd);
|
||||||
|
unmount("/mnt/acme", "/dev");
|
||||||
|
bind("/mnt/wsys", "/dev", MBEFORE);
|
||||||
|
cons = open("/dev/cons", OREAD);
|
||||||
|
if(cons==-1){
|
||||||
|
NoCons:
|
||||||
|
fprint(2, "page: can't open /dev/cons: %r");
|
||||||
|
wexits("no cons");
|
||||||
|
}
|
||||||
|
dup(cons, 0);
|
||||||
|
close(cons);
|
||||||
|
cons = open("/dev/cons", OWRITE);
|
||||||
|
if(cons==-1)
|
||||||
|
goto NoCons;
|
||||||
|
dup(cons, 1);
|
||||||
|
dup(cons, 2);
|
||||||
|
close(cons);
|
||||||
|
// wctlfd = open("/dev/wctl", OWRITE);
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
screenrect(void)
|
screenrect(void)
|
||||||
{
|
{
|
||||||
|
@ -1011,7 +1083,7 @@ zerox(void)
|
||||||
case 0:
|
case 0:
|
||||||
dup(pfd[1], 0);
|
dup(pfd[1], 0);
|
||||||
close(pfd[0]);
|
close(pfd[0]);
|
||||||
execl("/bin/page", "page", "-w", 0);
|
execl("/bin/page", "page", "-w", nil);
|
||||||
wexits("cannot exec in zerox: %r\n");
|
wexits("cannot exec in zerox: %r\n");
|
||||||
default:
|
default:
|
||||||
close(pfd[1]);
|
close(pfd[1]);
|
||||||
|
|
|
@ -113,7 +113,7 @@ int nextis(int c){
|
||||||
}
|
}
|
||||||
char *addtok(char *p, int val){
|
char *addtok(char *p, int val){
|
||||||
if(p==0) return 0;
|
if(p==0) return 0;
|
||||||
if(p==&tok[NTOK]){
|
if(p==&tok[NTOK-1]){
|
||||||
*p=0;
|
*p=0;
|
||||||
yyerror("token buffer too short");
|
yyerror("token buffer too short");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -226,7 +226,7 @@ connectto(char *machine, char **argv)
|
||||||
// count args
|
// count args
|
||||||
for(av = argv; *av; av++)
|
for(av = argv; *av; av++)
|
||||||
;
|
;
|
||||||
av = malloc(sizeof(char*)*((av-argv) + 5));
|
av = malloc(sizeof(char*)*((av-argv) + 10));
|
||||||
if(av == nil){
|
if(av == nil){
|
||||||
dprint("out of memory\n");
|
dprint("out of memory\n");
|
||||||
exits("fork/exec");
|
exits("fork/exec");
|
||||||
|
@ -234,6 +234,8 @@ connectto(char *machine, char **argv)
|
||||||
ac = 0;
|
ac = 0;
|
||||||
av[ac++] = RX;
|
av[ac++] = RX;
|
||||||
av[ac++] = machine;
|
av[ac++] = machine;
|
||||||
|
if(rxopt)
|
||||||
|
av[ac++] = rxopt;
|
||||||
av[ac++] = rsamname;
|
av[ac++] = rsamname;
|
||||||
av[ac++] = "-R";
|
av[ac++] = "-R";
|
||||||
while(*argv)
|
while(*argv)
|
||||||
|
|
|
@ -30,6 +30,7 @@ Disk *disk;
|
||||||
long seq;
|
long seq;
|
||||||
|
|
||||||
char *winsize;
|
char *winsize;
|
||||||
|
char *rxopt;
|
||||||
|
|
||||||
Rune baddir[] = { '<', 'b', 'a', 'd', 'd', 'i', 'r', '>', '\n'};
|
Rune baddir[] = { '<', 'b', 'a', 'd', 'd', 'i', 'r', '>', '\n'};
|
||||||
|
|
||||||
|
@ -56,6 +57,9 @@ main(int volatile argc, char **volatile argv)
|
||||||
case 'R':
|
case 'R':
|
||||||
Rflag++;
|
Rflag++;
|
||||||
break;
|
break;
|
||||||
|
case 'O':
|
||||||
|
rxopt = EARGF(usage());
|
||||||
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
samterm = EARGF(usage());
|
samterm = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
|
@ -118,7 +122,7 @@ main(int volatile argc, char **volatile argv)
|
||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
dprint("usage: sam [-d] [-t samterm] [-s sam name] -r machine\n");
|
dprint("usage: sam [-d] [-t samterm] [-s sam name] [-r machine] [file ...]\n");
|
||||||
exits("usage");
|
exits("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,7 @@ extern char SH[];
|
||||||
extern char SHPATH[];
|
extern char SHPATH[];
|
||||||
extern char RX[];
|
extern char RX[];
|
||||||
extern char RXPATH[];
|
extern char RXPATH[];
|
||||||
|
extern char *rxopt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* acme globals
|
* acme globals
|
||||||
|
|
|
@ -754,6 +754,8 @@ getreply(void)
|
||||||
reply = s_reset(reply);
|
reply = s_reset(reply);
|
||||||
for(;;){
|
for(;;){
|
||||||
line = getcrnl(reply);
|
line = getcrnl(reply);
|
||||||
|
if(debug)
|
||||||
|
Bflush(&berr);
|
||||||
if(line == 0)
|
if(line == 0)
|
||||||
return -1;
|
return -1;
|
||||||
if(!isdigit(line[0]) || !isdigit(line[1]) || !isdigit(line[2]))
|
if(!isdigit(line[0]) || !isdigit(line[1]) || !isdigit(line[2]))
|
||||||
|
@ -761,8 +763,6 @@ getreply(void)
|
||||||
if(line[3] != '-')
|
if(line[3] != '-')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(debug)
|
|
||||||
Bflush(&berr);
|
|
||||||
rv = atoi(line)/100;
|
rv = atoi(line)/100;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -999,6 +999,7 @@ getcrnl(String *s)
|
||||||
case '\r':
|
case '\r':
|
||||||
c = Bgetc(&bin);
|
c = Bgetc(&bin);
|
||||||
if(c == '\n'){
|
if(c == '\n'){
|
||||||
|
case '\n':
|
||||||
s_putc(s, c);
|
s_putc(s, c);
|
||||||
if(debug)
|
if(debug)
|
||||||
Bputc(&berr, c);
|
Bputc(&berr, c);
|
||||||
|
|
|
@ -24,6 +24,7 @@ MKDIRS=\
|
||||||
|
|
||||||
mkmk.sh:VD:
|
mkmk.sh:VD:
|
||||||
(
|
(
|
||||||
|
echo '# AUTOMATICALLY GENERATED - DO NOT EDIT'
|
||||||
echo cd lib9
|
echo cd lib9
|
||||||
echo 'echo cd `pwd`'
|
echo 'echo cd `pwd`'
|
||||||
(cd lib9; mk -n -a install)
|
(cd lib9; mk -n -a install)
|
||||||
|
|
Loading…
Reference in a new issue