mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-27 04:50:28 +00:00
Add lua repl interface to redbean
You can now interact with the global web server state on the command line, which the web server is running. This supports Emacs shortcuts with history, readline parity, <tab> completions, plus hints. Enjoy!
This commit is contained in:
parent
f6b6204b9e
commit
a6b02ce5a6
24 changed files with 848 additions and 463 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "libc/intrin/asancodes.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/lockcmpxchg.h"
|
||||
#include "libc/intrin/nomultics.internal.h"
|
||||
#include "libc/log/backtrace.internal.h"
|
||||
#include "libc/log/internal.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
|
@ -153,7 +154,6 @@ struct ReportOriginHeap {
|
|||
};
|
||||
|
||||
bool __asan_noreentry;
|
||||
extern bool __nomultics;
|
||||
static struct AsanMorgue __asan_morgue;
|
||||
|
||||
static wontreturn void __asan_unreachable(void) {
|
||||
|
|
|
@ -14,6 +14,7 @@ const char *DescribeFlags(char *, size_t, struct DescribeFlags *, size_t,
|
|||
|
||||
const char *DescribeMapFlags(int);
|
||||
const char *DescribeProtFlags(int);
|
||||
const char *DescribePollFlags(int);
|
||||
const char *DescribeRemapFlags(int);
|
||||
|
||||
const char *DescribeNtPageFlags(uint32_t);
|
||||
|
|
41
libc/intrin/describepollflags.greg.c
Normal file
41
libc/intrin/describepollflags.greg.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/nt/enum/filemapflags.h"
|
||||
#include "libc/sysv/consts/poll.h"
|
||||
|
||||
const char *DescribePollFlags(int x) {
|
||||
const struct DescribeFlags kPollFlags[] = {
|
||||
{POLLIN, "IN"}, // order matters
|
||||
{POLLOUT, "OUT"}, // order matters
|
||||
{POLLPRI, "PRI"}, //
|
||||
{POLLHUP, "HUP"}, //
|
||||
{POLLERR, "ERR"}, //
|
||||
{POLLNVAL, "NVAL"}, //
|
||||
{POLLRDBAND, "RDBAND"}, //
|
||||
{POLLRDHUP, "RDHUP"}, //
|
||||
{POLLRDNORM, "RDNORM"}, //
|
||||
{POLLWRBAND, "WRBAND"}, //
|
||||
{POLLWRNORM, "WRNORM"}, //
|
||||
};
|
||||
static char pollflags[64];
|
||||
return DescribeFlags(pollflags, sizeof(pollflags), kPollFlags,
|
||||
ARRAYLEN(kPollFlags), "POLL", x);
|
||||
}
|
|
@ -29,6 +29,7 @@
|
|||
#include "libc/intrin/cmpxchg.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/lockcmpxchg.h"
|
||||
#include "libc/intrin/nomultics.internal.h"
|
||||
#include "libc/intrin/spinlock.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.internal.h"
|
||||
|
@ -54,8 +55,6 @@ struct Timestamps {
|
|||
};
|
||||
|
||||
extern int __pid;
|
||||
extern bool __replmode;
|
||||
extern bool __nomultics;
|
||||
unsigned long long __kbirth; // see fork-nt.c
|
||||
|
||||
privileged static struct Timestamps kenter(void) {
|
||||
|
|
|
@ -26,5 +26,13 @@
|
|||
*
|
||||
* @see kprintf()
|
||||
*/
|
||||
bool __nomultics;
|
||||
bool __replmode;
|
||||
char __nomultics;
|
||||
|
||||
/**
|
||||
* Controls ANSI prefix for log emissions.
|
||||
*
|
||||
* This should be true in raw tty mode repls.
|
||||
*
|
||||
* @see kprintf(), vflogf(), linenoise()
|
||||
*/
|
||||
char __replmode;
|
||||
|
|
11
libc/intrin/nomultics.internal.h
Normal file
11
libc/intrin/nomultics.internal.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_INTRIN_NOMULTICS_INTERNAL_H_
|
||||
#define COSMOPOLITAN_LIBC_INTRIN_NOMULTICS_INTERNAL_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern bool __nomultics;
|
||||
extern bool __replmode;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_INTRIN_NOMULTICS_INTERNAL_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue