Skip to content

Commit

Permalink
Merge pull request #205 from wrapl/dev
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
rajamukherji authored Apr 15, 2024
2 parents 8d10fc7 + 7215b20 commit 2ae90d2
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 26 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ ifeq ($(PLATFORM), Linux)
objects += obj/targetwatch.o
endif

ifeq ($(PLATFORM), Android)
LDFLAGS += -Wl,--dynamic-list=src/exports.lst -ldl -lgc
endif

ifeq ($(PLATFORM), FreeBSD)
CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib -lgc-threaded
Expand Down
5 changes: 3 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rabs (2.30.6) UNRELEASED; urgency=medium
rabs (2.30.7) UNRELEASED; urgency=medium

* Updates.
* Updates.
Expand Down Expand Up @@ -57,5 +57,6 @@ rabs (2.30.6) UNRELEASED; urgency=medium
* Updates.
* Updates.
* Updates.
* Updates.

-- Raja Mukherji <raja@hinano> Thu, 04 Apr 2024 08:30:50 +0100
-- Raja Mukherji <raja@hinano> Mon, 15 Apr 2024 09:11:03 +0100
5 changes: 5 additions & 0 deletions docs/library/context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ context
A build context.


:mini:`fun context(Path?: string): context`
If :mini:`Path` is provided then returns the context with path :mini:`Path` or :mini:`nil` is no such context has been defined.
Otherwise returns the current context.


:mini:`meth (Context: context) :: (Name: string): symbol`
Returns the symbol :mini:`Name` resolved in :mini:`Context`.

Expand Down
5 changes: 0 additions & 5 deletions docs/library/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ general
Builds a shell command from :mini:`Command..` and executes it, capturing the output. Returns the captured output on success or raises an error.


:mini:`fun context(Path?: string): context`
If :mini:`Path` is provided then returns the context with path :mini:`Path` or :mini:`nil` is no such context has been defined.
Otherwise returns the current context.


:mini:`fun execv(Command: list): nil | error`
Similar to :mini:`execute()` but expects a list of individual arguments instead of letting the shell split the command line.

Expand Down
2 changes: 1 addition & 1 deletion minilang
Submodule minilang updated 120 files
2 changes: 1 addition & 1 deletion radb
Submodule radb updated 5 files
+6 −6 Makefile
+4 −0 fixed.c
+1 −0 fixed_store.h
+45 −1 string.c
+1 −0 string_store.h
17 changes: 16 additions & 1 deletion src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,23 @@
static stringmap_t ContextCache[1] = {STRINGMAP_INIT};
static ml_value_t *DefaultString;

ML_TYPE(ContextT, (MLAnyT), "context");
ML_FUNCTION(Context) {
//<Path?:string
//>context
// If :mini:`Path` is provided then returns the context with path :mini:`Path` or :mini:`nil` is no such context has been defined.
// Otherwise returns the current context.
if (Count > 0) {
ML_CHECK_ARG_TYPE(0, MLStringT);
return (ml_value_t *)context_find(ml_string_value(Args[0])) ?: MLNil;
} else {
return (ml_value_t *)CurrentContext;
}
}

ML_TYPE(ContextT, (MLAnyT), "context",
// A build context.
.Constructor = (ml_value_t *)Context
);

context_t *context_find(const char *Name) {
return stringmap_search(ContextCache, Name);
Expand Down
2 changes: 2 additions & 0 deletions src/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct context_t {
stringmap_t Locals[1];
};

extern ml_type_t ContextT[];

void context_init();

context_t *context_find(const char *Name);
Expand Down
15 changes: 1 addition & 14 deletions src/rabs.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,19 +315,6 @@ ML_FUNCTION(Vmount) {
return MLNil;
}

ML_FUNCTION(Context) {
//<Path?:string
//>context
// If :mini:`Path` is provided then returns the context with path :mini:`Path` or :mini:`nil` is no such context has been defined.
// Otherwise returns the current context.
if (Count > 0) {
ML_CHECK_ARG_TYPE(0, MLStringT);
return (ml_value_t *)context_find(ml_string_value(Args[0])) ?: MLNil;
} else {
return (ml_value_t *)CurrentContext;
}
}

#ifdef __MINGW32__
#define WIFEXITED(Status) (((Status) & 0x7f) == 0)
#define WEXITSTATUS(Status) (((Status) & 0xff00) >> 8)
Expand Down Expand Up @@ -923,7 +910,7 @@ int main(int Argc, char **Argv) {
stringmap_insert(Globals, "symbol", SymbolT);
stringmap_insert(Globals, "scan", ScanT);
stringmap_insert(Globals, "include", Include);
stringmap_insert(Globals, "context", Context);
stringmap_insert(Globals, "context", ContextT);
stringmap_insert(Globals, "execute", Execute);
stringmap_insert(Globals, "shell", Shell);
stringmap_insert(Globals, "execv", Execv);
Expand Down
2 changes: 1 addition & 1 deletion src/rabs.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern __thread target_t *CurrentTarget;
ml_value_t *rabs_global(const char *Name);
ml_value_t *rabs_ml_global(void *Data, const char *Name, const char *Source, int Line, int Mode);

#define CURRENT_VERSION 2, 30, 6
#define CURRENT_VERSION 2, 30, 7
#define MINIMAL_VERSION 2, 10, 0

#endif
2 changes: 1 addition & 1 deletion src/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ char *vfs_unsolve(const char *Path) {
while (Mount) {
//printf("%s -> %s\n", Mount->Path, Mount->Target);
const char *Suffix = match_prefix(Path, Mount->Target);
if (Suffix) Path = concat(Mount->Path, Suffix, NULL);
if (Suffix) Path = vfs_unsolve(concat(Mount->Path, Suffix, NULL));
Mount = Mount->Previous;
}
if (Path == Orig) Path = concat(Path, NULL);
Expand Down

0 comments on commit 2ae90d2

Please sign in to comment.