mes: Grand indent: prepare.
* build-aux/indent.sh: New file. * include/mes/builtins.h: Move from src/builtins.h. * include/fcntl.h: Use // *INDENT-OFF* to prevent indent breakage. * include/locale.h: Likewise. * include/signal.h: Likewise. * include/sys/stat.h: Likewise. * include/sys/user.h: Likewise. * lib/linux/x86-mes-gcc/crt0.c: Likewise. * lib/linux/x86-mes-gcc/crt1.c: Likewise. * lib/linux/x86-mes-gcc/mes.c: Likewise. * lib/linux/x86-mes-gcc/mini.c: Likewise. * lib/linux/x86_64-mes-gcc/crt0.c: Likewise. * lib/linux/x86_64-mes-gcc/crt1.c: Likewise. * lib/linux/x86_64-mes-gcc/mes.c: Likewise. * lib/linux/x86_64-mes-gcc/mini.c: Likewise. * lib/x86_64-mes-gcc/setjmp.c: Likewise. * src/mes.c: Likewise. * src/reader.c: Likewise.
This commit is contained in:
parent
1d56567c50
commit
a46c318bb8
21
build-aux/indent.sh
Executable file
21
build-aux/indent.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#! /bin/sh
|
||||
|
||||
# GNU Mes --- Maxwell Equations of Software
|
||||
# Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
#
|
||||
# This file is part of GNU Mes.
|
||||
#
|
||||
# GNU Mes is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
# GNU Mes is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
for i in $(find . -name '*.c' -o -name '*.h' -o -name '*.i'); do indent $i --no-tabs --line-length 110 --honour-newlines; done
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#else // ! WITH_GLIBC
|
||||
|
||||
// *INDENT-OFF*
|
||||
#define O_RDONLY 0
|
||||
#define O_WRONLY 1
|
||||
#define O_RDWR 2
|
||||
|
@ -37,6 +38,7 @@
|
|||
#define O_TRUNC 0x200
|
||||
#define O_APPEND 0x400
|
||||
#define O_DIRECTORY 0x10000
|
||||
// *INDENT-ON*
|
||||
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
|
|
|
@ -29,12 +29,15 @@
|
|||
|
||||
#else // ! WITH_GLIBC
|
||||
|
||||
// *INDENT-OFF*
|
||||
#ifndef LC_ALL
|
||||
#define LC_CTYPE 0
|
||||
#define LC_NUMERIC 1
|
||||
#define LC_COLLATE 3
|
||||
#define LC_ALL 6
|
||||
#endif
|
||||
// *INDENT-ON*
|
||||
|
||||
char * setlocale (int category, char const *locale);
|
||||
|
||||
#endif // ! WITH_GLIBC
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef long stack_t;
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
// *INDENT-OFF*
|
||||
#define NSIG 30
|
||||
#define SIGHUP 1
|
||||
#define SIGINT 2
|
||||
|
@ -85,7 +86,6 @@ typedef long stack_t;
|
|||
#define SA_NOMASK SA_NODEFER
|
||||
#define SA_ONESHOT SA_RESETHAND
|
||||
|
||||
|
||||
typedef struct siginfo_t
|
||||
{
|
||||
int si_signo;
|
||||
|
@ -113,7 +113,7 @@ typedef struct siginfo_t
|
|||
int si_syscall;
|
||||
unsigned int si_arch;
|
||||
} siginfo_t;
|
||||
|
||||
// *INDENT-ON*
|
||||
|
||||
#if __MESC__
|
||||
typedef long sighandler_t;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
typedef int mode_t;
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
#if __i386__
|
||||
struct stat
|
||||
{
|
||||
|
@ -79,6 +80,7 @@ struct stat
|
|||
unsigned long __foo1;
|
||||
};
|
||||
#endif
|
||||
// *INDENT-ON*
|
||||
|
||||
int chmod (char const *file_name, mode_t mode);
|
||||
int mkdir (char const *file_name, mode_t mode);
|
||||
|
|
|
@ -77,6 +77,7 @@ struct user_regs_struct
|
|||
long int xss;
|
||||
};
|
||||
|
||||
// *INDENT-OFF*
|
||||
struct user
|
||||
{
|
||||
struct user_regs_struct regs;
|
||||
|
@ -89,8 +90,8 @@ struct user
|
|||
unsigned long int start_stack;
|
||||
long int signal;
|
||||
int reserved;
|
||||
struct user_regs_struct* u_ar0;
|
||||
struct user_fpregs_struct* u_fpstate;
|
||||
struct user_regs_struct *u_ar0;
|
||||
struct user_fpregs_struct *u_fpstate;
|
||||
unsigned long int magic;
|
||||
char u_comm [32];
|
||||
int u_debugreg [8];
|
||||
|
@ -103,6 +104,7 @@ struct user
|
|||
#define UPAGES 1
|
||||
#define HOST_TEXT_START_ADDR (u.start_code)
|
||||
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
|
||||
// *INDENT-ON*
|
||||
|
||||
#endif // ! WITH_GLIBC
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <mes/lib-mini.h>
|
||||
int _main (int argc, char *argv[]);
|
||||
|
||||
// *INDENT-OFF*
|
||||
void
|
||||
_start ()
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <mes/lib-mini.h>
|
||||
//int main (int argc, char *argv[], char *envp[]);
|
||||
|
||||
// *INDENT-OFF*
|
||||
void
|
||||
_start ()
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <errno.h>
|
||||
#include <linux/x86/syscall.h>
|
||||
|
||||
// *INDENT-OFF*
|
||||
long
|
||||
_sys_call (long sys_call)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define SYS_exit "0x01"
|
||||
#define SYS_write "0x04"
|
||||
|
||||
// *INDENT-OFF*
|
||||
void
|
||||
_exit (int code)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ int main (int argc, char *argv[]);
|
|||
// gcc x86_64 calling convention:
|
||||
// rdi, rsi, rdx, rcx, r8, r9, <stack0>, <stack1>
|
||||
|
||||
// *INDENT-OFF*
|
||||
void
|
||||
_start ()
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
// gcc x86_64 calling convention:
|
||||
// rdi, rsi, rdx, rcx, r8, r9, <stack0>, <stack1>
|
||||
|
||||
// *INDENT-OFF*
|
||||
void
|
||||
_start ()
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
// #define R0 rax
|
||||
// #define R1 rdi
|
||||
|
||||
// *INDENT-OFF*
|
||||
long
|
||||
_sys_call (long sys_call)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define SYS_exit "0x3c"
|
||||
#define SYS_write "0x01"
|
||||
|
||||
// *INDENT-OFF*
|
||||
void
|
||||
_exit (int code)
|
||||
{
|
||||
|
|
|
@ -24,13 +24,16 @@ void
|
|||
longjmp (jmp_buf env, int val)
|
||||
{
|
||||
val = val == 0 ? 1 : val;
|
||||
asm ("mov 0x8(%ebp),%ebp\n\t" // env*
|
||||
// *INDENT-OFF*
|
||||
asm (
|
||||
"mov 0x8(%ebp),%ebp\n\t" // env*
|
||||
|
||||
"mov 0x4(%ebp),%ebx\n\t" // env->__pc
|
||||
"mov 0x8(%ebp),%esp\n\t" // env->__sp
|
||||
"mov 0x0(%ebp),%ebp\n\t" // env->__bp
|
||||
"jmp *%ebx\n\t" // jmp *PC
|
||||
);
|
||||
// *INDENT-ON*
|
||||
// not reached
|
||||
exit (42);
|
||||
}
|
||||
|
|
|
@ -24,12 +24,14 @@ void
|
|||
longjmp (jmp_buf env, int val)
|
||||
{
|
||||
val = val == 0 ? 1 : val;
|
||||
// *INDENT-OFF*
|
||||
asm (
|
||||
"mov 0x00(%rdi),%rbp\n\t" // env->__bp
|
||||
"mov 0x08(%rdi),%rbx\n\t" // env->__pc
|
||||
"mov 0x10(%rdi),%rsp\n\t" // env->__sp
|
||||
"jmp *%rbx\n\t" // jmp *PC
|
||||
);
|
||||
// *INDENT-ON*
|
||||
// not reached
|
||||
exit (42);
|
||||
}
|
||||
|
@ -38,10 +40,12 @@ int
|
|||
setjmp (jmp_buf env)
|
||||
{
|
||||
long *p;
|
||||
// *INDENT-OFF*
|
||||
asm ("mov %%rbp,%0"
|
||||
: "=r" (p)
|
||||
: //no inputs ""
|
||||
);
|
||||
// *INDENT-ON*
|
||||
env[0].__bp = p;
|
||||
env[0].__pc = p[1];
|
||||
env[0].__sp = p[0];
|
||||
|
|
|
@ -385,7 +385,7 @@ struct scm *g_news = 0;
|
|||
// CONSTANT cell_test 118
|
||||
#define cell_test 118
|
||||
|
||||
#include "builtins.h"
|
||||
#include "mes/builtins.h"
|
||||
|
||||
#define TYPE(x) g_cells[x].type
|
||||
#define CAR(x) g_cells[x].car
|
||||
|
|
|
@ -232,10 +232,9 @@ reader_read_hash (int c, SCM a)
|
|||
if (c == ':')
|
||||
{
|
||||
SCM x = reader_read_identifier_or_number (readchar ());
|
||||
SCM msg = MAKE_STRING0 ("keyword perifx ':' not followed by a symbol: ");
|
||||
if (TYPE (x) == TNUMBER)
|
||||
error (cell_symbol_system_error, // READ error
|
||||
cons (MAKE_STRING0 ("keyword perifx ':' not followed by a symbol: "),
|
||||
x));
|
||||
error (cell_symbol_system_error, cons (msg, x));
|
||||
return symbol_to_keyword (x);
|
||||
}
|
||||
if (c == 'b')
|
||||
|
|
Loading…
Reference in a new issue