1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-15 14:27:19 +00:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Nick Briggs
f7e40d1ed5 Use symbolic constants for COLOR related subrs rather than numbers
cases for subrs UNCOLORIZE-BITMAP, COLORIZE-BITMAP, COLOR-8BPPDRAWLINE (which
are not compiled into current code) can have the numbers replaced by the
symbolic constants that are now defined in subrs.h
2021-09-19 14:19:42 -07:00
Nick Briggs
9bb5a4298c Use symbolic constant for subr CAUSE-INTERRUPT switch/case rather than number (0222) 2021-09-19 14:12:47 -07:00
Nick Briggs
533c935e72 Fix various bugprone warnings (#397)
* Fix some warnings in main.c

main.c:678: narrowing conversion from 'unsigned long' to signed type 'int' is implementation-defined
main.c:493: The return value from the call to 'seteuid' is not checked.

* Fix some warnings in array operations

Instead of extracting typenumbers to an 'int', use the unsigned typenumber directly

array3.c:49: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array4.c:61: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array5.c:63: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array6.c:50: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined

* Resolve type mismatches for version numbers and propp flag

dir.c:1849: narrowing conversion from 'unsigned int' to signed type 'int'
dir.c:1850: narrowing conversion from 'unsigned int' to signed type 'int'
dir.c:2114: narrowing conversion from 'unsigned long' to signed type 'int'
dir.c:2207: narrowing conversion from 'unsigned int' to signed type 'int'

* Resolve type mismatches for version numbers and strlen result type

dsk.c:1072: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1108: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1549: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1712: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1751: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:3426: narrowing conversion from 'unsigned int' to signed type 'int'

* Resolve type mismatches for strlen result type

ufs.c:213: narrowing conversion from 'unsigned long' to signed type 'int'
ufs.c:404: narrowing conversion from 'unsigned long' to signed type 'int'

* Resolve type error

uutils.c:117: 'signed char' to 'int' conversion [bugprone-signed-char-misuse,cert-str34-c]
2021-09-16 17:24:25 -07:00
Nick Briggs
6fedd97d21 add yield subr (#398)
* Add experimental SUBR to call nanosleep() for experiments in reducing CPU load

This adds a SUBR, sb_YIELD, value (octal) 0322 which takes a single number
0..999999999 which is the number of nanoseconds to pass to nanosleep().

The return value is T if the call to nanosleep() was executed or NIL
if it was not (argument out-of-range, or other error in getting the
number from the argument).

To use this experimental SUBR in a sysout you should:

   (SETQ \INITSUBRS (CONS '(YIELD #o322) \INITSUBRS))

then you can define functions that use that SUBR:

   (DEFINEQ (BACKGROUND-YIELD () (SUBRCALL YIELD 833333)))
   (COMPILE 'BACKGROUND-YIELD)
   (SETQ BACKGROUNDFNS (CONS 'BACKGROUND-YIELD BACKGROUNDFNS))

* Update to use subrs.h newly generated from LLSUBRS

The subrs.h include file is generated by WRITECALLSUBRS based on the \INITSUBRS
list.  This update provides for the new YIELD subr in the generated file,
and makes some necessary updates to the C code implementations for some subr
names which have changed.
2021-09-15 10:30:04 -07:00
Nick Briggs
a70b18d444 Avoid use of sscanf() for parsing simple integer values (#396)
There is no reason to use sscanf() rather than strtol()/strtoul()
for parsing simple integer values from a string.
Resolves a number of cert-str34-c warnings from clang-tidy.
2021-09-12 14:24:05 -07:00
Larry Masinter
c7adb3c4ba Add scripts to aid in constructing github releases of the maiko artifacts (#395)
Until these are superceded by github actions, if the github CLI tool "gh"
is installed, a github release of the maiko code can be created by running
   ./start-release
from the maiko/bin directory, and then running
   ./release-one
for each combination of OS/architecture that should be included in the
release.

The scripts assume that the maiko code is checked out in a directory
named "maiko" (and may produce unexpected results if run from somewhere else)

Co-authored-by: Nick Briggs <nicholas.h.briggs@gmail.com>
2021-09-10 13:33:54 -07:00
Nick Briggs
b1545e4ccc fix 'signed char' to 'int' conversion [cert-str34-c]
Fortunately here we don't need to convert to unsigned char then int,
we can do the only comparisons we need staying in the char domain.
2021-09-09 18:01:02 -07:00
15 changed files with 328 additions and 258 deletions

44
bin/release-one Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
# Make and release maiko for one os / arch
# Hopefully to be replaced by GitHub Action
if [ ! -x ../../maiko/bin/machinetype ] ; then
echo ERROR: Must be run from maiko/bin
exit 1
fi
tag=$1
if [ -z "$tag" ] ; then
tag=maiko-`date +%y%m%d`
fi
export PATH=.:"$PATH"
osarch=`osversion`.`machinetype`
./makeright x
./makeright init
cd ../..
mkdir -p maiko/build
echo making $tag-$osarch.tgz
tar cfz maiko/build/$tag-$osarch.tgz \
maiko/bin/osversion \
maiko/bin/machinetype \
maiko/bin/config.guess \
maiko/bin/config.sub \
maiko/$osarch/lde*
if ! command -v gh >/dev/null ; then
echo
echo The GitHub Command Line Interface, gh
echo does not seem to be installed.
echo Please upload maiko/build/$tag-$osarch.tgz
echo to https://github.com/Interlisp/maiko/releases $tag
exit 0
fi
echo uploading
cd maiko
gh release upload --clobber $tag build/$tag-$osarch.tgz

36
bin/start-release Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/sh
# This script is just a placeholder until we get GitHub
# Actions to do releases
# Start Maiko release from maiko/bin
# startrelease [tag]
# tag defaults to maiko-YYMMDD
tag=$1
if [ -z "$tag" ] ; then
tag=maiko-`date +%y%m%d`
fi
if ! command -v gh >/dev/null ; then
echo "It seems like 'gh', the GitHub Command Line Interface is"
echo "not installed. You can start a release using the"
echo "web interface at"
echo "https://github.com/Interlisp/maiko/releases/new"
echo "Make up a tag (or use $tag)"
echo "and run './release-one tag' (or manually upload if"
echo "no 'gh' is installed) on every os/machine you want"
echo "this release to work for"
exit 0
fi
# Now for the only thing this script is actually doing
gh release create $tag -p -t $tag -n "See release notes in medley repo"
echo "Now run "
echo ./release-one $tag
echo "in maiko/bin on every os/machine you want this release"
echo "to work for. When done, edit the release in your"
echo "browser and uncheck the prerelease box "

View File

@@ -71,7 +71,7 @@
}
static inline LispPTR
aref_switch(int type, LispPTR tos, LispPTR baseL, int index)
aref_switch(unsigned type, LispPTR tos, LispPTR baseL, int index)
{
LispPTR result;
DLword *wordp;

View File

@@ -1,194 +1,150 @@
#ifndef SUBRS_H
#define SUBRS_H 1
/* $Id: subrs.h,v 1.2 1999/01/03 02:06:24 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* This file written from LLSUBRS on 13-Sep-2021 15:19:22 */
/* Do not edit this file! Instead, edit the list \initsubrs */
/* on the lisp file LLSUBRS and then call WRITECALLSUBRS to */
/* generate a new version. */
#define sb_BACKGROUNDSUBR 06
#define sb_CHECKBCPLPASSWORD 07
#define sb_DISKPARTITION 010
#define sb_DSPBOUT 011
#define sb_DSPRATE 012
#define sb_GATHERSTATS 013
#define sb_GETPACKETBUFFER 014
#define sb_LISPFINISH 015
#define sb_MOREVMEMFILE 016
#define sb_RAID 017
#define sb_READRAWPBI 020
#define sb_WRITERAWPBI 021
#define sb_SETSCREENCOLOR 022
#define sb_SHOWDISPLAY 023
#define sb_PUPLEVEL1STATE 024
#define sb_WRITESTATS 025
#define sb_CONTEXTSWITCH 026
#define sb_COPYSYS0SUBR 027
#define sb_WRITEMAP 030
#define sb_UFS_GETFILENAME 042
#define sb_UFS_DELETEFILE 043
#define sb_UFS_RENAMEFILE 044
#define sb_COM_READPAGES 045
#define sb_COM_WRITEPAGES 046
#define sb_COM_TRUNCATEFILE 047
#define sb_UFS_DIRECTORYNAMEP 051
#define sb_COM_GETFREEBLOCK 055
#define sb_SETUNIXTIME 060
#define sb_GETUNIXTIME 061
#define sb_COPYTIMESTATS 062
#define sb_UNIX_USERNAME 063
#define sb_UNIX_FULLNAME 064
#define sb_UNIX_GETENV 065
#define sb_UNIX_GETPARM 066
#define sb_CHECK_SUM 067
#define sb_ETHER_SUSPEND 070
#define sb_ETHER_RESUME 071
#define sb_ETHER_AVAILABLE 072
#define sb_ETHER_RESET 073
#define sb_ETHER_GET 074
#define sb_ETHER_SEND 075
#define sb_ETHER_SETFILTER 076
#define sb_ETHER_CHECK 077
#define sb_DSPCURSOR 0100
#define sb_SETMOUSEXY 0101
#define sb_DSP_VIDEOCOLOR 0102
#define sb_DSP_SCREENWIDTH 0103
#define sb_DSP_SCREENHEIGHT 0104
#define sb_BITBLTSUB 0105
#define sb_BLTCHAR 0106
#define sb_TEDIT_BLTCHAR 0107
#define sb_BITBLT_BITMAP 0110
#define sb_BLTSHADE_BITMAP 0111
#define sb_RS232C_CMD 0112
#define sb_RS232C_READ_INIT 0113
#define sb_RS232C_WRITE 0114
#define sb_KEYBOARDBEEP 0120
#define sb_KEYBOARDMAP 0121
#define sb_KEYBOARDSTATE 0122
#define sb_VMEMSAVE 0131
#define sb_LISP_FINISH 0132
#define sb_NEWPAGE 0133
#define sb_DORECLAIM 0134
#define sb_DUMMY_135Q 0135
#define sb_NATIVE_MEMORY_REFERENCE 0136
#define sb_OLD_COMPILE_LOAD_NATIVE 0137 /* obsolete */
#define sb_DISABLEGC 0140
#define sb_COM_SETFILEINFO 0147
#define sb_COM_OPENFILE 0150
#define sb_COM_CLOSEFILE 0151
#define sb_DSK_GETFILENAME 0152
#define sb_DSK_DELETEFILE 0153
#define sb_DSK_RENAMEFILE 0154
#define sb_COM_NEXT_FILE 0156
#define sb_COM_FINISH_FINFO 0157
#define sb_COM_GEN_FILES 0160
#define sb_DSK_DIRECTORYNAMEP 0161
#define sb_COM_GETFILEINFO 0162
#define sb_COM_CHANGEDIR 0164
#define sb_UNIX_HANDLECOMM 0165
#define sb_OCR_COMM 0166
#define sb_RPC_CALL 0167
#define sb_MESSAGE_READP 0170
#define sb_MESSAGE_READ 0171
#define sb_MONITOR_CONTROL 0200
#define sb_GET_NATIVE_ADDR_FROM_LISP_PTR 0203
#define sb_GET_LISP_PTR_FROM_NATIVE_ADDR 0204
#define sb_LOAD_NATIVE_FILE 0205 /* obsolete */
#define sb_SUSPEND_LISP 0206
#define sb_NEW_BLTCHAR 0207
#define sb_COLOR_INIT 0210
#define sb_COLOR_SCREENMODE 0211
#define sb_COLOR_MAP 0212
#define sb_COLOR_BASE 0213
#define sb_C_SlowBltChar 0214
#define sb_TCP_OP 0220
#define sb_WITH_SYMBOL 0221
/* For linear-programming interface */
#define sb_LP_SETUP 0230
#define sb_LP_RUN 0231
/* For Native Windows */
#define sb_MNW_OP 0244
#define sb_QUERY_WINDOWS 0245
#define sb_FILL_IN 0246
/* DLD codes */
#define sb_CALL_C_FN 0247
#define sb_DLD_LINK 0250
#define sb_DLD_UNLINK_BY_FILE 0251
#define sb_DLD_UNLINK_BY_SYMBOL 0252
#define sb_DLD_GET_SYMBOL 0253
#define sb_DLD_GET_FUNC 0254
#define sb_DLD_FUNCTION_EXECUTABLE_P 0255
#define sb_DLD_LIST_UNDEFINED_SYM 0256
#define sb_MALLOC 0257
#define sb_FREE 0260
#define sb_PUT_C_BASEBYTE 0261
#define sb_GET_C_BASEBYTE 0262
#define sb_SMASHING_APPLY 0263
#ifdef TRUECOLOR
#define sb_PICTURE_OP 0250
#define sb_TRUE_COLOR_OP 0251
#ifdef VIDEO
#define sb_VIDEO_OP 0252
#endif /* VIDEO */
#endif /* TRUECOLOR */
#define sb_CHAR_OPENFILE 0310
#define sb_CHAR_BIN 0311
#define sb_CHAR_BOUT 0312
#define sb_CHAR_IOCTL 0313
#define sb_CHAR_CLOSEFILE 0314
#define sb_CHAR_EOFP 0315
#define sb_CHAR_READP 0316
#define sb_CHAR_BINS 0317
#define sb_CHAR_BOUTS 0320
#define sb_CHAR_FILLBUFFER 0321
/* on the lisp file LLSUBRS and then call WRITECALLSUBRS to */
/* generate a new version. */
#define sb_BACKGROUNDSUBR 06
#define sb_CHECKBCPLPASSWORD 07
#define sb_DISKPARTITION 010
#define sb_DSPBOUT 011
#define sb_DSPRATE 012
#define sb_GATHERSTATS 013
#define sb_GETPACKETBUFFER 014
#define sb_LISPFINISH 015
#define sb_MOREVMEMFILE 016
#define sb_RAID 017
#define sb_READRAWPBI 020
#define sb_WRITERAWPBI 021
#define sb_SETSCREENCOLOR 022
#define sb_SHOWDISPLAY 023
#define sb_PUPLEVEL1STATE 024
#define sb_WRITESTATS 025
#define sb_CONTEXTSWITCH 026
#define sb_COPYSYS0SUBR 027
#define sb_WRITEMAP 030
#define sb_UFS_GETFILENAME 042
#define sb_UFS_DELETEFILE 043
#define sb_UFS_RENAMEFILE 044
#define sb_COM_READPAGES 045
#define sb_COM_WRITEPAGES 046
#define sb_COM_TRUNCATEFILE 047
#define sb_UFS_DIRECTORYNAMEP 051
#define sb_COM_GETFREEBLOCK 055
#define sb_SETUNIXTIME 060
#define sb_GETUNIXTIME 061
#define sb_COPYTIMESTATS 062
#define sb_UNIX_USERNAME 063
#define sb_UNIX_FULLNAME 064
#define sb_UNIX_GETENV 065
#define sb_UNIX_GETPARM 066
#define sb_CHECK_SUM 067
#define sb_ETHER_SUSPEND 070
#define sb_ETHER_RESUME 071
#define sb_ETHER_AVAILABLE 072
#define sb_ETHER_RESET 073
#define sb_ETHER_GET 074
#define sb_ETHER_SEND 075
#define sb_ETHER_SETFILTER 076
#define sb_ETHER_CHECK 077
#define sb_DSPCURSOR 0100
#define sb_SETMOUSEXY 0101
#define sb_DSP_VIDEOCOLOR 0102
#define sb_DSP_SCREENWIDTH 0103
#define sb_DSP_SCREENHEIGHT 0104
#define sb_BITBLTSUB 0105
#define sb_BLTCHAR 0106
#define sb_TEDIT_BLTCHAR 0107
#define sb_BITBLT_BITMAP 0110
#define sb_BLTSHADE_BITMAP 0111
#define sb_RS232C_CMD 0112
#define sb_RS232C_READ_INIT 0113
#define sb_RS232C_WRITE 0114
#define sb_KEYBOARDBEEP 0120
#define sb_KEYBOARDMAP 0121
#define sb_KEYBOARDSTATE 0122
#define sb_VMEMSAVE 0131
#define sb_LISP_FINISH 0132
#define sb_NEWPAGE 0133
#define sb_DORECLAIM 0134
#define sb_DUMMY_135Q 0135
#define sb_NATIVE_MEMORY_REFERENCE 0136
#define sb_OLD_COMPILE_LOAD_NATIVE 0137
#define sb_DISABLEGC 0140
#define sb_COM_SETFILEINFO 0147
#define sb_COM_OPENFILE 0150
#define sb_COM_CLOSEFILE 0151
#define sb_DSK_GETFILENAME 0152
#define sb_DSK_DELETEFILE 0153
#define sb_DSK_RENAMEFILE 0154
#define sb_COM_NEXT_FILE 0156
#define sb_COM_FINISH_FINFO 0157
#define sb_COM_GEN_FILES 0160
#define sb_DSK_DIRECTORYNAMEP 0161
#define sb_COM_GETFILEINFO 0162
#define sb_COM_CHANGEDIR 0164
#define sb_UNIX_HANDLECOMM 0165
#define sb_RPC_CALL 0167
#define sb_MESSAGE_READP 0170
#define sb_MESSAGE_READ 0171
#define sb_MONITOR_CONTROL 0200
#define sb_GET_NATIVE_ADDR_FROM_LISP_PTR 0203
#define sb_GET_LISP_PTR_FROM_NATIVE_ADDR 0204
#define sb_LOAD_NATIVE_FILE 0205
#define sb_SUSPEND_LISP 0206
#define sb_NEW_BLTCHAR 0207
#define sb_COLOR_INIT 0210
#define sb_COLOR_SCREENMODE 0211
#define sb_COLOR_MAP 0212
#define sb_COLOR_BASE 0213
#define sb_C_SlowBltChar 0214
#define sb_UNCOLORIZE_BITMAP 0215
#define sb_COLORIZE_BITMAP 0216
#define sb_COLOR_8BPPDRAWLINE 0217
#define sb_TCP_OP 0220
#define sb_WITH_SYMBOL 0221
#define sb_CAUSE_INTERRUPT 0222
#define sb_OPEN_SOCKET 0240
#define sb_CLOSE_SOCKET 0241
#define sb_READ_SOCKET 0242
#define sb_WRITE_SOCKET 0243
#define sb_CALL_C_FUNCTION 0247
#define sb_DLD_LINK 0250
#define sb_DLD_UNLINK_BY_FILE 0251
#define sb_DLD_UNLINK_BY_SYMBOL 0252
#define sb_DLD_GET_SYMBOL 0253
#define sb_DLD_GET_FUNC 0254
#define sb_DLD_FUNCTION_EXECUTABLE_P 0255
#define sb_DLD_LIST_UNDEFINED_SYMBOLS 0256
#define sb_C_MALLOC 0257
#define sb_C_FREE 0260
#define sb_C_PUTBASEBYTE 0261
#define sb_C_GETBASEBYTE 0262
#define sb_CHAR_OPENFILE 0310
#define sb_CHAR_BIN 0311
#define sb_CHAR_BOUT 0312
#define sb_CHAR_IOCTL 0313
#define sb_CHAR_CLOSEFILE 0314
#define sb_CHAR_EOFP 0315
#define sb_CHAR_READP 0316
#define sb_CHAR_BINS 0317
#define sb_CHAR_BOUTS 0320
#define sb_CHAR_FILLBUFFER 0321
#define sb_YIELD 0322
/* MISCN opcodes */
#define miscn_USER_SUBR 00
#define miscn_VALUES 01
#define miscn_SXHASH 02
#define miscn_EQLHASHBITSFN 03
#define miscn_STRINGHASHBITS 04
#define miscn_STRING_EQUAL_HASHBITS 05
#define miscn_VALUES_LIST 06
#define miscn_LCFetchMethod 07
#define miscn_LCFetchMethodOrHelp 010
#define miscn_LCFindVarIndex 011
#define miscn_LCGetIVValue 012
#define miscn_LCPutIVValue 013
/* for accessing RAW RS232C port */
#define miscn_RAW_RS232C_OPEN 050
#define miscn_RAW_RS232C_CLOSE 051
#define miscn_RAW_RS232C_SETPARAM 052
#define miscn_RAW_RS232C_GETPARAM 053
#define miscn_RAW_RS232C_READ 054
#define miscn_RAW_RS232C_WRITE 055
#define miscn_RAW_RS232C_SETINT 056
/* for CHATTER */
#define miscn_CHATTER 040
/* for EJLISP */
#define miscn_EJLISP 060
#define miscn_USER_SUBR 00
#define miscn_VALUES 01
#define miscn_SXHASH 02
#define miscn_EQLHASHBITSFN 03
#define miscn_STRINGHASHBITS 04
#define miscn_STRING_EQUAL_HASHBITS 05
#define miscn_VALUES_LIST 06
#define miscn_LCFetchMethod 07
#define miscn_LCFetchMethodOrHelp 010
#define miscn_LCFindVarIndex 011
#define miscn_LCGetIVValue 012
#define miscn_LCPutIVValue 013
/* Assigned USER SUBR numbers */
#define user_subr_DUMMY 012
#define user_subr_SAMPLE_USER_SUBR 00
#define user_subr_DUMMY 012
#define user_subr_SAMPLE_USER_SUBR 00
#endif

View File

@@ -33,7 +33,7 @@
/*** N_OP_aref1 -- op 266 (array index) ***/
LispPTR N_OP_aref1(register LispPTR arrayarg, register LispPTR inx) {
register LispPTR baseL;
register int type, index;
register int index;
register OneDArray *arrayblk;
/* verify array */
@@ -45,12 +45,9 @@ LispPTR N_OP_aref1(register LispPTR arrayarg, register LispPTR inx) {
if (index >= arrayblk->totalsize) ERROR_EXIT(inx);
index += arrayblk->offset;
/* setup typenumber */
type = 0xFF & arrayblk->typenumber;
/* setup base */
baseL = arrayblk->base;
/* disp on type */
return (aref_switch(type, inx, baseL, index));
return (aref_switch(arrayblk->typenumber, inx, baseL, index));
} /* end N_OP_aref1() */

View File

@@ -42,7 +42,6 @@
/************************************************************************/
LispPTR N_OP_aset1(register LispPTR data, LispPTR arrayarg, register int inx) {
register int type;
register OneDArray *arrayblk;
register LispPTR base;
register int new;
@@ -57,14 +56,11 @@ LispPTR N_OP_aset1(register LispPTR data, LispPTR arrayarg, register int inx) {
if (index >= arrayblk->totalsize) ERROR_EXIT(inx);
index += arrayblk->offset;
/* setup typenumber */
type = 0xFF & arrayblk->typenumber;
/* setup base */
base = arrayblk->base;
/* disp on type */
aset_switch(type, inx);
aset_switch(arrayblk->typenumber, inx);
doufn:
ERROR_EXIT(inx);

View File

@@ -41,7 +41,6 @@
LispPTR N_OP_aref2(LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
#define REG
LispPTR baseL;
int type;
int arindex, temp;
LispArray *arrayblk;
int j;
@@ -59,9 +58,6 @@ LispPTR N_OP_aref2(LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
arindex *= j;
arindex += temp;
/* setup typenumber */
type = 0xFF & arrayblk->typenumber;
/* disp on type */
return (aref_switch(type, inx1, baseL, arindex));
return (aref_switch(arrayblk->typenumber, inx1, baseL, arindex));
} /* end N_OP_aref2() */

View File

@@ -26,7 +26,6 @@
/*** N_OP_aset2 -- op 357 (new-value array index0 index1) ***/
LispPTR N_OP_aset2(register LispPTR data, LispPTR arrayarg, LispPTR inx0, LispPTR inx1) {
register int type;
register LispArray *arrayblk;
register LispPTR base;
register int new;
@@ -46,11 +45,8 @@ LispPTR N_OP_aset2(register LispPTR data, LispPTR arrayarg, LispPTR inx0, LispPT
index *= j;
index += temp;
/* setup typenumber */
type = 0xFF & arrayblk->typenumber;
/* disp on type */
aset_switch(type, inx1);
aset_switch(arrayblk->typenumber, inx1);
doufn:
ERROR_EXIT(inx1);

View File

@@ -1602,7 +1602,7 @@ static int trim_finfo_highest(FINFO **fp, int highestp)
* Name: trim_finfo_version
*
* Argument: FINFO **fp Linked list of the numerated FINFO structures.
* int rver Requested version number.
* unsigned rver Requested version number.
*
* Value: Returns the total number of files still remaining in **fp.
*
@@ -1614,7 +1614,7 @@ static int trim_finfo_highest(FINFO **fp, int highestp)
* are got rid of.
*/
static int trim_finfo_version(FINFO **fp, int rver)
static int trim_finfo_version(FINFO **fp, unsigned rver)
{
register FINFO *tp, *sp, *mp, *cp, *pp, *vp;
register int num, pnum;
@@ -1840,7 +1840,8 @@ static FINFO **prepare_sort_buf(register FINFO *fp, register int n)
static int dsk_filecmp(FINFO **fp1, FINFO **fp2)
{
register int res, v1, v2;
register int res;
unsigned v1, v2;
if ((res = strcmp((*fp1)->no_ver_name, (*fp2)->no_ver_name)) != 0) return (res);
@@ -2032,7 +2033,8 @@ LispPTR COM_gen_files(register LispPTR *args)
#ifdef DOS
char drive[1];
#endif
int dskp, count, highestp, propp, fid, version;
int dskp, count, highestp, fid;
unsigned propp, version;
register char *cp;
FINFO *fp;
int dsk_filecmp(), unix_filecmp();
@@ -2193,7 +2195,8 @@ LispPTR COM_next_file(register LispPTR *args)
register char *base;
register DFINFO *dfp;
register UFSGFS *gfsp;
int finfoid, propp;
int finfoid;
unsigned propp;
ERRSETJMP(-1);
Lisp_errno = &Dummy_errno;

View File

@@ -851,7 +851,8 @@ LispPTR COM_closefile(register LispPTR *args)
LispPTR DSK_getfilename(register LispPTR *args)
{
register char *base;
register int len, dirp, rval;
size_t len, rval;
register int dirp;
int fatp;
char lfname[MAXPATHLEN];
char aname[MAXNAMLEN];
@@ -1510,7 +1511,8 @@ LispPTR DSK_directorynamep(register LispPTR *args)
{
char dirname[MAXPATHLEN];
char fullname[MAXPATHLEN];
register int len, fatp;
size_t len;
register int fatp;
register char *base;
#ifdef DOS
char drive[1], rawname[MAXNAMLEN];
@@ -1697,7 +1699,8 @@ LispPTR COM_getfileinfo(register LispPTR *args)
*bufp = sbuf.st_mode;
return (ATOM_T);
case AUTHOR:
case AUTHOR: {
size_t rval;
#ifndef DOS
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
@@ -1717,8 +1720,9 @@ LispPTR COM_getfileinfo(register LispPTR *args)
#endif /* BYTESWAP */
#endif /* DOS */
return (GetSmallp(rval));
case ALL:
}
case ALL: {
size_t rval;
/*
* The format of the buffer which has been allocated by Lisp
* is as follows.
@@ -1756,7 +1760,7 @@ LispPTR COM_getfileinfo(register LispPTR *args)
#endif /* BYTESWAP */
#endif /* DOS */
return (GetSmallp(rval));
}
default: return (NIL);
}
}
@@ -2502,8 +2506,8 @@ int true_name(register char *path)
#ifdef DOS
char drive[1];
#endif
register char *sp, *cp;
register int type, c;
register char c, *sp, *cp;
register int type;
if (strcmp(path, "/") == 0) return (-1);
@@ -3395,7 +3399,8 @@ static int get_versionless(FileName *varray, char *file, char *dir)
static int check_vless_link(char *vless, FileName *varray, char *to_file, int *highest_p)
{
register int rval, max_no, found;
register int rval, found;
unsigned max_no;
ino_t vless_ino;
struct stat sbuf;
char dir[MAXPATHLEN], name[MAXNAMLEN], ver[VERSIONLEN];

View File

@@ -490,7 +490,10 @@ int main(int argc, char *argv[])
#else
if (getuid() != geteuid()) {
fprintf(stderr, "Effective user is not real user. Setting euid to uid.\n");
seteuid(getuid());
if (seteuid(getuid()) == -1) {
fprintf(stderr, "Unable to reset effective user id to real user id\n");
exit(1);
}
}
#endif /* DOS */
@@ -624,7 +627,6 @@ void start_lisp() {
int makepathname(char *src, char *dst)
{
register int len;
register char *base, *cp;
register struct passwd *pwd;
char name[MAXPATHLEN];
@@ -675,7 +677,7 @@ int makepathname(char *src, char *dst)
if ((cp = (char *)strchr(base + 1, '/')) == 0)
return (0);
else {
len = (UNSIGNED)cp - (UNSIGNED)base - 1;
size_t len = cp - base - 1;
strncpy(name, base + 1, len);
name[len] = '\0';
#ifndef DOS

View File

@@ -29,6 +29,7 @@
/***********************************************************/
#include <stdio.h>
#include <time.h>
#include "lispemul.h"
#include "address.h"
#include "adr68k.h"
@@ -62,6 +63,9 @@
#include "unixcommdefs.h"
#include "uutilsdefs.h"
#include "vmemsavedefs.h"
#ifdef MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE
#include "foreigndefs.h"
#endif
extern LispPTR *PENDINGINTERRUPT68k;
@@ -336,17 +340,17 @@ void OP_subrcall(int subr_no, int argnum) {
C_slowbltchar(args);
break;
case 0215:
case sb_UNCOLORIZE_BITMAP:
POP_SUBR_ARGS;
Uncolorize_Bitmap(args);
break;
case 0216:
case sb_COLORIZE_BITMAP:
POP_SUBR_ARGS;
Colorize_Bitmap(args);
break;
case 0217:
case sb_COLOR_8BPPDRAWLINE:
POP_SUBR_ARGS;
Draw_8BppColorLine(args);
break;
@@ -669,7 +673,7 @@ void OP_subrcall(int subr_no, int argnum) {
TopOfStack = with_symbol(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case 0222: /* Cause an interrupt to occur. Used by */
case sb_CAUSE_INTERRUPT: /* Cause an interrupt to occur. Used by */
/* Lisp INTERRUPTED to re-set an interrupt */
/* when it's uninterruptible. */
POP_SUBR_ARGS;
@@ -682,7 +686,7 @@ void OP_subrcall(int subr_no, int argnum) {
/*****************************************/
/* foreign-function-call support subrs */
/*****************************************/
case sb_CALL_C_FN: {
case sb_CALL_C_FUNCTION: {
POP_SUBR_ARGS;
TopOfStack = call_c_fn(args); /* args[0]=fnaddr, args[1]=fn type */
break;
@@ -717,27 +721,27 @@ void OP_subrcall(int subr_no, int argnum) {
TopOfStack = Mdld_function_executable_p(args);
break;
}
case sb_DLD_LIST_UNDEFINED_SYM: {
case sb_DLD_LIST_UNDEFINED_SYMBOLS: {
POP_SUBR_ARGS;
TopOfStack = Mdld_list_undefined_sym();
break;
}
case sb_MALLOC: {
case sb_C_MALLOC: {
POP_SUBR_ARGS;
TopOfStack = c_malloc(args);
break;
}
case sb_FREE: {
case sb_C_FREE: {
POP_SUBR_ARGS;
TopOfStack = c_free(args);
break;
}
case sb_PUT_C_BASEBYTE: {
case sb_C_PUTBASEBYTE: {
POP_SUBR_ARGS;
TopOfStack = put_c_basebyte(args);
break;
}
case sb_GET_C_BASEBYTE: {
case sb_C_GETBASEBYTE: {
POP_SUBR_ARGS;
TopOfStack = get_c_basebyte(args);
break;
@@ -779,6 +783,20 @@ void OP_subrcall(int subr_no, int argnum) {
break;
}
#endif /* LPSOLVE */
case sb_YIELD: {
struct timespec rqts = {0, 833333};
unsigned sleepnanos;
POP_SUBR_ARGS;
N_GETNUMBER(args[0], sleepnanos, ret_nil);
if (sleepnanos > 999999999) {
TopOfStack = NIL;
break;
}
rqts.tv_nsec = sleepnanos;
nanosleep(&rqts, NULL);
TopOfStack = ATOM_T;
break;
}
default: {
char errtext[200];
sprintf(errtext, "OP_subrcall: Invalid alpha byte 0%o", ((*(PC + 1)) & 0xff));

View File

@@ -156,7 +156,8 @@ exit_host_filesystem() {
LispPTR UFS_getfilename(LispPTR *args)
{
register char *base;
register int len, rval;
size_t len;
register int rval;
char lfname[MAXPATHLEN], file[MAXPATHLEN];
ERRSETJMP(NIL);
@@ -369,7 +370,8 @@ LispPTR UFS_directorynamep(LispPTR *args)
{
char dirname[MAXPATHLEN];
char fullname[MAXPATHLEN];
register int len, rval;
size_t len;
register int rval;
register char *base;
struct stat sbuf;

View File

@@ -19,6 +19,7 @@
/************************************************************************/
/************************************************************************/
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
@@ -349,6 +350,7 @@ unsigned int uGetTN(unsigned int address) {
LispPTR uraid_commands() {
int num, address, val;
char *endpointer;
LispPTR index;
DefCell *defcell68k;
#ifndef DOS
@@ -383,7 +385,9 @@ LispPTR uraid_commands() {
printf("DUMP-STACK: f decimal-FXnumber\n");
return (T);
}
if (sscanf(URaid_arg1, "%d", &num) <= 0) { /* com read fails */
errno = 0;
num = strtoul(URaid_arg1, &endpointer, 10);
if (errno != 0 || *endpointer != '\0') { /* com read fails */
printf("Illegal argument, not decimal number\n");
return (T);
}
@@ -511,7 +515,9 @@ LispPTR uraid_commands() {
printf("PRINT-INSTANCE: O HEX-LispAddress\n");
return (T);
}
if (sscanf(URaid_arg1, "%x", &objaddr) <= 0) {
errno = 0;
objaddr = strtoul(URaid_arg1, &endpointer, 16);
if (errno != 0 || *endpointer != '\0') {
printf("Arg not HEX number\n");
return (T);
}
@@ -524,7 +530,9 @@ LispPTR uraid_commands() {
}
/**HEXNUMP(URaid_arg1,"Not Address");**/
if (sscanf(URaid_arg1, "%x", &address) <= 0) {
errno = 0;
address = strtoul(URaid_arg1, &endpointer, 16);
if (errno != 0 || *endpointer != '\0') {
printf("Arg not HEX number\n");
return (T);
}
@@ -609,17 +617,21 @@ LispPTR uraid_commands() {
printf("HEX-DUMP: x Xaddress [Xnum]\n");
return (T);
}
if (sscanf(URaid_arg1, "%x", &address) <= 0) { /* arg1 not HEX */
errno = 0;
address = strtoul(URaid_arg1, &endpointer, 16);
if (errno != 0 || *endpointer != '\0') {
printf("Arg(Xaddress) not Xaddress\n");
return (T);
}
switch (sscanf(URaid_arg2, "%x", &num)) {
case -1: /* Use defaultval for word-num */ num = XDUMPW; break;
case 0: /* Illegal number */
if (URaid_arg2[0] == '\0') {
num = XDUMPW;
} else {
errno = 0;
num = strtol(URaid_arg2, &endpointer, 16);
if (errno != 0 || *endpointer != '\0') {
printf("Arg(Xnum) not Xnum\n");
return (T);
/* break; */
default: break;
}
}
if (num < 0) {
printf("Dump words num should be positive\n");
@@ -657,7 +669,9 @@ LispPTR uraid_commands() {
} else if (*URaid_arg2 == 'T')
val = ATOM_T;
else {
if (sscanf(URaid_arg2, "%d", &val) == -1) {
errno = 0;
val = strtol(URaid_arg2, &endpointer, 10);
if (errno != 0 || *endpointer != '\0') {
printf(" Bad value\n");
return (T);
} else {
@@ -691,11 +705,15 @@ LispPTR uraid_commands() {
HEXNUMP(URaid_arg2,"Not Proper Value");
***/
if (sscanf(URaid_arg1, "%x", &address) <= 0) {
errno = 0;
address = strtol(URaid_arg1, &endpointer, 16);
if (errno != 0 || *endpointer != '\0') {
printf("Arg(Xaddress) not Xaddress\n");
return (T);
}
if (sscanf(URaid_arg2, "%x", &val) <= 0) {
errno = 0;
val = strtol(URaid_arg2, &endpointer, 16);
if (errno != 0 || *endpointer != '\0') {
printf("Arg(Xval) not Xaddress\n");
return (T);
}
@@ -791,13 +809,14 @@ LispPTR uraid_commands() {
case '(':
if (URaid_argnum == 1)
num = 2;
else if ((URaid_arg1[0] < '0') || (URaid_arg1[0] > '9')) {
printf("Illegal argument, not number\n");
return (T);
} else
sscanf(URaid_arg1, "%d", &num);
else {
errno = 0;
num = strtoul(URaid_arg1, &endpointer, 10);
if (errno != 0 || *endpointer != '\0') {
printf("Illegal argument, not number\n");
return (T);
}
}
PrintMaxLevel = num;
printf("PrintLevel is set to %d.", num);
break;

View File

@@ -114,7 +114,7 @@ int c_string_to_lisp_string(char *C, LispPTR Lisp) {
register size_t i;
register char *dp;
for (i = 0, dp = C; i < length + 1; i++) {
int ch = *dp++;
char ch = *dp++;
#ifdef DOS
if (ch == '\\') dp++; /* skip 2nd \ in \\ in C strings */
#endif /* DOS */