Merge remote-tracking branch 'upstream/default' into carl-ansi-part1

# Conflicts:
#	util/arch/archiver.c
#	util/led/finish.c
#	util/led/output.c
This commit is contained in:
carl 2019-03-24 21:42:56 +08:00
commit 56e64a1fd0
30 changed files with 57 additions and 29 deletions

View file

@ -10,6 +10,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
struct exec {
short a_magic;
@ -28,6 +30,7 @@ struct nlist
short n_value;
};
#include <object.h>
#include <out.h>
#ifndef NORCSID
@ -164,14 +167,14 @@ main(argc, argv)
}
/* Action at last */
wr_int2(e->a_magic);
wr_int2(e->a_text);
wr_int2(e->a_data);
wr_int2(e->a_bss);
wr_int2(e->a_syms);
wr_int2(e->a_entry);
wr_int2(e->a_unused);
wr_int2(e->a_flag);
cv_int2(e->a_magic);
cv_int2(e->a_text);
cv_int2(e->a_data);
cv_int2(e->a_bss);
cv_int2(e->a_syms);
cv_int2(e->a_entry);
cv_int2(e->a_unused);
cv_int2(e->a_flag);
emits(&outsect[TEXTSG]) ;
emits(&outsect[ROMSG]) ;
emits(&outsect[DATASG]) ;
@ -180,14 +183,14 @@ main(argc, argv)
return 0;
}
wr_int2(n)
cv_int2(n)
{
putc(n, output);
putc((n>>8), output);
}
/*
wr_long(l)
cv_long(l)
long l;
{
putc((int)(l >> 16), output);
@ -231,7 +234,6 @@ emit_symtab()
struct nlist PDP_name; /* symbol table entry in PDP V7 format */
register unsigned short i;
extern char *malloc();
char *chars;
long l;
long off = OFF_CHAR(outhead);
@ -289,8 +291,8 @@ emit_symtab()
PDP_name.n_name[j] = 0;
}
fwrite((char *) &PDP_name, sizeof(char), 8, output);
wr_int2(PDP_name.n_type);
wr_int2(PDP_name.n_value);
cv_int2(PDP_name.n_type);
cv_int2(PDP_name.n_value);
}
}

View file

@ -11,6 +11,7 @@
struct ar_hdr;
struct outhead;
struct outname;
struct outrelo;
struct outsect;
struct ranlib;

View file

@ -4,6 +4,7 @@
*/
/* $Id$ */
#include <unistd.h>
#include "system.h"
int

View file

@ -4,6 +4,7 @@
*/
/* $Id$ */
#include <unistd.h>
#include "system.h"
void

View file

@ -4,6 +4,7 @@
*/
/* $Id$ */
#include <fcntl.h>
#include "system.h"
extern File *_get_entry();
@ -14,7 +15,7 @@ sys_create(filep, path, mode)
char *path;
int mode;
{
register fd;
register int fd;
register File *fp;
if ((fp = _get_entry()) == (File *)0)

View file

@ -4,6 +4,8 @@
*/
/* $Id$ */
#include <fcntl.h>
#include <unistd.h>
#include "system.h"
extern File *_get_entry();
@ -16,7 +18,6 @@ sys_open(path, flag, filep)
{
register int fd;
register File *fp;
long lseek();
if ((fp = _get_entry()) == (File *)0)
return 0;

View file

@ -4,6 +4,7 @@
*/
/* $Id$ */
#include <unistd.h>
#include "system.h"
int

View file

@ -4,10 +4,9 @@
*/
/* $Id$ */
#include <unistd.h>
#include "system.h"
long lseek();
int
sys_seek(fp, off, whence, poff)
File *fp;

View file

@ -1,5 +1,4 @@
#define _XOPEN_SOURCE 500
#define _POSIX_C_SOURCE 200809
#define _XOPEN_SOURCE 700
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -440,4 +439,4 @@ int file_rename(cpm_filename_t* src, cpm_filename_t* dest)
int drivefd = get_drive_fd(src);
return renameat(drivefd, srcunixfilename, drivefd, destunixfilename);
}
}

View file

@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <out.h>
#include <object.h>

View file

@ -6,6 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "ack.h"
#include "list.h"
#include "trans.h"

View file

@ -4,9 +4,11 @@
*
*/
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "ack.h"
#include "list.h"
#include "trans.h"
@ -386,7 +388,7 @@ static int process(char* arg)
if (linker)
add_input(&orig, linker);
return 1;
case F_OK:
case F_TRANSFORM:
break;
}
if (!phase)
@ -555,7 +557,7 @@ static void setneeds(const char* suffix, int tail)
p_suffix = suffix;
switch (getpath(&phase))
{
case F_OK:
case F_TRANSFORM:
for (; phase; phase = phase->t_next)
{
if (phase->t_needed)

View file

@ -4,9 +4,11 @@
*
*/
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "ack.h"
#include "list.h"
#include "trans.h"

View file

@ -237,7 +237,7 @@ static enum f_path scan_end(trf **first) { /* Finalization */
*first= curr ;
}
if ( curr->t_next ) {
return F_OK ;
return F_TRANSFORM ;
}
prev=curr ;
}
@ -249,7 +249,7 @@ static enum f_path scan_end(trf **first) { /* Finalization */
if ( prev ) {
prev->t_keep=YES ;
}
return F_OK ;
return F_TRANSFORM ;
}
static void find_cpp(void) {

View file

@ -57,7 +57,7 @@ void add_input(path *, trf *);
int runphase(trf *);
/* scan.c */
enum f_path { F_OK, F_NOMATCH, F_NOPATH } ;
enum f_path { F_TRANSFORM, F_NOMATCH, F_NOPATH } ;
enum f_path getpath(trf **);
/* trans.c */

View file

@ -24,6 +24,7 @@
#include <stdbool.h>
#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include "out.h"
#define ASSERT(x) switch (2) { case 0: case (x): ; }

View file

@ -10,11 +10,14 @@
** anm [-gopruns] [name ...]
*/
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include "object.h"
#include "out.h"
#include "arch.h"
#include "ranlib.h"

View file

@ -7,6 +7,7 @@ static char rcsid[] = "$Id$";
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <object.h>
#include <out.h>
#define OK 0 /* Return value of gethead if Orl Korekt. */

View file

@ -6,6 +6,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "object.h"
#include "out.h"
/*

View file

@ -4,9 +4,12 @@
*/
/* $Id$ */
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include "object.h"
#include "out.h"
/*

View file

@ -26,6 +26,7 @@
#endif
*/
#include <fcntl.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
@ -552,6 +553,7 @@ void get(int argc, char *argv[])
*/
void add(char *name, FILE* ar, FILE* dst, char *mess)
{
<<<<<<< HEAD
static MEMBER member;
size_t read_chars;
struct stat status;

View file

@ -26,7 +26,7 @@ int main(int argc, const char* argv[])
count++;
}
printf("\n};\n");
printf("const size_t %s_len = %d;\n", argv[1], count);
printf("const size_t %s_len = %zu;\n", argv[1], count);
return 0;
}

View file

@ -4,8 +4,10 @@
/* $Id$ */
#include <fcntl.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include "logging.h"
#include "global.h"

View file

@ -11,6 +11,7 @@ static char rcsid[] = "$Id$";
#include <stdint.h>
#include <stdbool.h>
#include "arch.h"
#include "object.h"
#include "out.h"
#include "ranlib.h"
#include "object.h"

View file

@ -11,6 +11,7 @@ static char rcsid[] = "$Id$";
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <unistd.h>
#include <out.h>
#include "const.h"

View file

@ -126,8 +126,6 @@ static void handle_relos(struct outhead *head, struct outsect *sects, struct out
register int sectindex;
register int nrelo;
register char *emit;
extern char *getemit();
extern struct outrelo *nextrelo();
static long zeros[MAXSECT];
if (incore) {
@ -168,7 +166,6 @@ static void handle_relos(struct outhead *head, struct outsect *sects, struct out
long sz = sects[sectindex].os_flen;
long sf = 0;
long blksz;
char *getblk();
emit = getblk(sz, &blksz, sectindex);
while (sz) {

View file

@ -12,6 +12,7 @@ static char rcsid[] = "$Id$";
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <object.h>
#include "out.h"
#include "object.h"
#include "const.h"

View file

@ -23,6 +23,7 @@ static char rcsid[]= "$Id$";
#include <assert.h>
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include "varinfo.h"
#include "param.h"
#include "reg.h"

View file

@ -4,6 +4,7 @@ static char rcsid[] = "$Id$";
#include <assert.h>
#include <stdio.h>
#include <unistd.h>
#include "param.h"
#include "types.h"
#include <em_pseu.h>

View file

@ -11,6 +11,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "Lpars.h"
extern int lineno, newline;