Skip to content

Commit

Permalink
Merge pull request #361 from olebole/noirlab-sys
Browse files Browse the repository at this point in the history
NOIRLAB: Small bugfixes for libsys
  • Loading branch information
olebole authored Jan 28, 2024
2 parents 76925f7 + 315f970 commit 7b006ca
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 66 deletions.
1 change: 1 addition & 0 deletions lib/nmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ define NMI_INT 32
define NMI_LONG 32
define NMI_REAL -32
define NMI_DOUBLE -64
define NMI_BOOL (SZ_BOOL*8)

# Name aliases for generic code.
define nmipaks nmipak16
Expand Down
19 changes: 9 additions & 10 deletions math/nlfit/nlfitdefd.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ define NL_CHOFAC Memi[$1+29] # Pointer to Cholesky factorization

# Access to buffers
define PLIST Memi[$1] # Parameter list
define OPARAM Memd[$1] # Original parameter vector
define PARAM Memd[$1] # Parameter vector
define DPARAM Memd[$1] # Parameter change vector
define ALPHA Memd[$1] # Alpha matrix
define BETA Memd[$1] # Beta matrix
define TRY Memd[$1] # Trial vector
define DERIV Memd[$1] # Derivatives
define CHOFAC Memd[$1] # Cholesky factorization
define COVAR Memd[$1] # Covariance matrix

define OPARAM Memd[P2P($1)] # Original parameter vector
define PARAM Memd[P2P($1)] # Parameter vector
define DPARAM Memd[P2P($1)] # Parameter change vector
define ALPHA Memd[P2P($1)] # Alpha matrix
define BETA Memd[P2P($1)] # Beta matrix
define TRY Memd[P2P($1)] # Trial vector
define DERIV Memd[P2P($1)] # Derivatives
define CHOFAC Memd[P2P($1)] # Cholesky factorization
define COVAR Memd[P2P($1)] # Covariance matrix

# Defined constants alter for tricky problems
define LAMBDAMAX 1000.0
Expand Down
19 changes: 9 additions & 10 deletions math/nlfit/nlfitdefr.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ define NL_CHOFAC Memi[$1+29] # Pointer to Cholesky factorization

# Access to buffers
define PLIST Memi[$1] # Parameter list
define OPARAM Memr[$1] # Original parameter vector
define PARAM Memr[$1] # Parameter vector
define DPARAM Memr[$1] # Parameter change vector
define ALPHA Memr[$1] # Alpha matrix
define BETA Memr[$1] # Beta matrix
define TRY Memr[$1] # Trial vector
define DERIV Memr[$1] # Derivatives
define CHOFAC Memr[$1] # Cholesky factorization
define COVAR Memr[$1] # Covariance matrix

define OPARAM Memr[P2P($1)] # Original parameter vector
define PARAM Memr[P2P($1)] # Parameter vector
define DPARAM Memr[P2P($1)] # Parameter change vector
define ALPHA Memr[P2P($1)] # Alpha matrix
define BETA Memr[P2P($1)] # Beta matrix
define TRY Memr[P2P($1)] # Trial vector
define DERIV Memr[P2P($1)] # Derivatives
define CHOFAC Memr[P2P($1)] # Cholesky factorization
define COVAR Memr[P2P($1)] # Covariance matrix

# Defined constants alter for tricky problems
define LAMBDAMAX 1000.0
Expand Down
2 changes: 0 additions & 2 deletions sys/etc/gen/nmireadb.x
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ int pksize, nchars, nelem
int nmipksize(), nminelem(), read()
errchk read()

long note()

begin
pksize = nmipksize (maxelem, NMI_BOOL)
nelem = EOF
Expand Down
2 changes: 0 additions & 2 deletions sys/etc/miireadc.x
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ int pksize, nchars
int miipksize(), miinelem(), read()
errchk read()

long note()

begin
pksize = miipksize (maxchars, MII_BYTE)
nchars = max (maxchars, pksize)
Expand Down
6 changes: 4 additions & 2 deletions sys/etc/urlget.x
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ char fname[ARB] #i local filename
pointer reply #u pointer to reply string

char protocol[SZ_FNAME], host[SZ_FNAME], path[SZ_BUF], emsg[SZ_PATHNAME]
char inurl[SZ_LINE], outname[SZ_LINE]
char inurl[SZ_BUF], outname[SZ_PATHNAME]
int port, stat
pointer buf

Expand All @@ -58,7 +58,7 @@ define redirect_ 99

begin
# Breakup the URL into usable pieces.
call strcpy (url, inurl, SZ_LINE)
call strcpy (url, inurl, SZ_BUF)
redirect_
call url_break (inurl, protocol, host, port, path)

Expand Down Expand Up @@ -125,6 +125,8 @@ begin
for (op=1; op <= SZ_LINE && ip <= reply + SZ_BUF && Memc[ip] != '\n' && Memc[ip] != EOS; op=op+1) {
url[op] = Memc[ip]
ip = ip + 1
if (ip > (reply + SZ_BUF - 1))
break
}
url[op-1] = EOS

Expand Down
4 changes: 2 additions & 2 deletions sys/fio/fntgfn.x
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ int npat # receives number of PATP elements set
pointer sbuf # used to store output strings
int maxch # maxch chars out
int ch, peek
char ch, peek
bool is_url
pointer op
Expand Down Expand Up @@ -786,7 +786,7 @@ int token #O token type code
int nseen, i
pointer ip, ip_start, op, cp
int stridx(), strncmp()
int stridx()
begin
ip = U_TEMPLATE_INDEX(pp) # retrieve pointer
Expand Down
2 changes: 1 addition & 1 deletion sys/fio/vfnmap.x
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ end

int procedure vvfn_checksum (a, nchars)

char a[nchars] # array to be summed
int a[nchars] # array to be summed
int nchars # length of array
int i, sum

Expand Down
5 changes: 3 additions & 2 deletions sys/fmtio/evvexpr.gy
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ $/

%token CONSTANT IDENTIFIER NEWLINE YYEOS
%token PLUS MINUS STAR SLASH EXPON CONCAT QUEST COLON
%token LT GT LE GT EQ NE SE LAND LOR LNOT BAND BOR BXOR BNOT AT
%token LT GT LE EQ NE SE LAND LOR LNOT BAND BOR BXOR BNOT AT
%token GE UMINUS

%nonassoc QUEST
%left LAND LOR
Expand Down Expand Up @@ -1368,7 +1369,7 @@ begin
optype = O_TYPE(args[1])
nelem = O_LEN(args[1])
do i = 2, nargs {
optype = xvv_newtype (optype, args[i])
optype = xvv_newtype (optype, O_TYPE(args[i]))
if (O_LEN(args[i]) > 0)
if (nelem > 0)
nelem = min (nelem, O_LEN(args[i]))
Expand Down
63 changes: 35 additions & 28 deletions sys/gio/fonts/mkfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,13 @@ main (int argc, char *argv[])
hlength = htab[hindex].length;
dp = data = htab[hindex].code;

if (DEBUG)
printf ("'%c' %4d: index=%4d len=%3d dlen=%3d %s\n",
ch, hnum, hindex, hlength, strlen(data),
(strlen(data) % 2) ? "ERROR" : "");

/* Now decode the stroke data into X-Y pairs, first pair is for
* proportional spacing.
*/
minx = (*dp - 'R'); dp++;
maxx = (*dp - 'R'); dp++;
chrwid[charnum++] = min (32, maxx - minx + 5);

if (DEBUG) printf("\twidth (%02d) (%d,%d)\n", maxx-minx,minx,maxx);

/* Next pair is the initial move. The Y coords are flipped
* for what we need so fix that every place we get a Yval.
*/
Expand All @@ -81,8 +74,6 @@ x = (ch == '1' ? x-3: x);
y = YCOORD(); dp++;
chrtab[idx++] = ENCODE(pen, x, y);

if (DEBUG) printf ("\tmove (%3d,%3d) '%s'\n", x, y, dp);

/* The remainder of the codes are move/draw strokes.
*/
for (i=0; i < (hlength-2); i++) {
Expand All @@ -99,10 +90,6 @@ x = (ch == '1' ? x-3: x);
y = YCOORD(); dp++;

chrtab[idx++] = ENCODE(pen, x, y);

if (DEBUG)
printf("\t%s (%3d,%3d) => %6d\n",
pen?"draw":"move", x, y, ENCODE(pen,x,y));
}
chrtab[idx++] = ENCODE(0, 0, 0);
ch++;
Expand All @@ -117,58 +104,78 @@ x = (ch == '1' ? x-3: x);
}


int
print_index (int *idxtab, int N)
static void
print_index (
int *idxtab,
int N
)
{
register int i, j, start=1, end=5;
char ch;

for (i=0; i < N; ) {
printf ("data (chridx(i), i=%03d,%03d) /", start, min(N,end));
for (j=0; j < 5 && i < N; j++)
printf ("%5d%c", idxtab[i++], (j<4 && i<N ? ',' : '/'));
for (j=0; j < 5 && i < N; j++) {
ch = (j<4 && i<N ? ',' : '/');
printf ("%5d%c", idxtab[i++], ch);
}
printf ("\n");
start = end + 1;
end += 5;
}
}


int
print_widths (int *wtab, int N)
static void
print_widths (
int *wtab,
int N
)
{
register int i, j, start=1, end=5;
char ch;

for (i=0; i < N; ) {
printf ("data (chrwid(i), i=%03d,%03d) /", start, min(N,end));
for (j=0; j < 5 && i < N; j++)
printf ("%5d%c", wtab[i++], (j<4 && i<N ? ',' : '/'));
for (j=0; j < 5 && i < N; j++) {
ch = (j<4 && i<N ? ',' : '/');
printf ("%5d%c", wtab[i++], ch);
}
printf ("\n");
start = end + 1;
end += 5;
}
}


int
print_strokes (int *strtab, int N)
static void
print_strokes (
int *strtab,
int N
)
{
register int i, j, start=1, end=5;
char ch;

for (i=0; i < N; ) {
printf ("data (chrtab(i), i=%04d,%04d) /", start, min(N,end));
for (j=0; j < 5 && i < N; j++)
printf ("%6d%c", strtab[i++], (j<4 && i<N ? ',' : '/'));
for (j=0; j < 5 && i < N; j++) {
ch = (j<4 && i<N ? ',' : '/');
printf ("%6d%c", strtab[i++], ch);
}
printf ("\n");
start = end + 1;
end += 5;
}
}


int
print_prologue (int nidx, int nchar)
static void
print_prologue (
int nidx,
int nchar
)
{

printf ("# CHRTAB -- Table of strokes for the printable ASCII characters. Each\n");
printf ("# character is encoded as a series of strokes. Each stroke is ex-\n");
printf ("# pressed by a single integer containing the following bitfields:\n");
Expand Down
1 change: 0 additions & 1 deletion sys/imio/immapz.x
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ begin
# to be called when the first i/o operation occurs.
IM_FAST(im) = YES
IM_FAST(im) = NO
# Set the image name field, used by IMERR everywhere.
call strcpy (inname, IM_NAME(im), SZ_IMNAME)
Expand Down
3 changes: 2 additions & 1 deletion sys/imio/impmmapo.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ begin

# Set up the image descriptor.
IM_NDIM(im) = naxes
IM_NPHYSDIM(im) = IM_NPHYSDIM(ref_im)
if (ref_im != NULL)
IM_NPHYSDIM(im) = IM_NPHYSDIM(ref_im)
IM_PIXTYPE(im) = TY_INT
call amovl (axlen, IM_LEN(im,1), IM_MAXDIM)

Expand Down
2 changes: 1 addition & 1 deletion sys/ki/kopdpr.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ begin
}

} else {
# Spawning of detached processes on remote nodes is not really
# Spawning of detached processes on remote notes is not really
# supported as of yet. Add support for passing the bkgmsg; use
# node name in bkgmsg to submit bkg job to remote node.

Expand Down
9 changes: 7 additions & 2 deletions sys/ki/zzrdks.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ int spoolfd = 0;
* it, delete the file, edit the Makefile, and change the reference to
* zzrdks in irafks.x to zardks.
*/
int
zzrdks_ (int *chan, short *buf, int *maxb, int *off)
void
zzrdks_ (
int *chan,
short *buf,
int *maxb,
int *off
)
{
int status;

Expand Down
3 changes: 2 additions & 1 deletion sys/libc/ccnvdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ c_cnvdate (
{
XCHAR buf[SZ_LINE];
XINT x_maxch = SZ_LINE;
XLONG _clktime = clktime;

CNVDATE (&clktime, buf, &x_maxch);
CNVDATE (&_clktime, buf, &x_maxch);
return (c_strpak (buf, outstr, maxch));
}
3 changes: 2 additions & 1 deletion sys/libc/ccnvtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ c_cnvtime (
{
XCHAR buf[SZ_LINE];
XINT x_maxch = SZ_LINE;
XLONG _clktime = clktime;

CNVTIME (&clktime, buf, &x_maxch);
CNVTIME (&_clktime, buf, &x_maxch);
return (c_strpak (buf, outstr, maxch));
}

0 comments on commit 7b006ca

Please sign in to comment.