Skip to content

Commit

Permalink
Merge branch 'master' into win32
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Somerville committed Jan 27, 2013
2 parents 5c70f51 + 6a72c37 commit 3fea5e8
Show file tree
Hide file tree
Showing 33 changed files with 329 additions and 350 deletions.
1 change: 1 addition & 0 deletions inc/slash/ast.h
Expand Up @@ -42,6 +42,7 @@ typedef enum sl_node_type {
SL_NODE_LAST,
SL_NODE_THROW,
SL_NODE_YADA_YADA,
SL_NODE_USE,
SL_NODE__REGISTER
}
sl_node_type_t;
Expand Down
9 changes: 9 additions & 0 deletions inc/slash/class.h
Expand Up @@ -66,4 +66,13 @@ sl_class_of(sl_vm_t* vm, SLVAL obj);
SLVAL
sl_new(sl_vm_t* vm, SLVAL klass, size_t argc, SLVAL* argv);

SLVAL
sl_camel_case_to_underscore(sl_vm_t* vm, SLVAL str);

bool
sl_class_has_full_path(sl_vm_t* vm, SLVAL klass);

SLVAL
sl_class_file_path(sl_vm_t* vm, SLVAL klass);

#endif
1 change: 1 addition & 0 deletions inc/slash/lex.h
Expand Up @@ -46,6 +46,7 @@ typedef enum sl_token_type {
SL_TOK_NEXT,
SL_TOK_LAST,
SL_TOK_THROW,
SL_TOK_USE,

SL_TOK_OPEN_PAREN,
SL_TOK_CLOSE_PAREN,
Expand Down
10 changes: 10 additions & 0 deletions inc/slash/platform.h
Expand Up @@ -8,9 +8,19 @@ struct sl_vm;
char*
sl_realpath(struct sl_vm* vm, char* path);

typedef enum sl_file_type {
SL_FT_NO_EXIST,
SL_FT_FILE,
SL_FT_DIR
}
sl_file_type_t;

int
sl_file_exists(struct sl_vm* vm, char* path);

sl_file_type_t
sl_file_type(struct sl_vm* vm, char* path);

int
sl_abs_file_exists(char* path);

Expand Down
2 changes: 1 addition & 1 deletion inc/slash/string.h
Expand Up @@ -13,7 +13,7 @@ SLVAL
sl_make_string_enc(sl_vm_t* vm, char* buff, size_t buff_len, char* encoding);

SLVAL
sl_make_cstring(struct sl_vm* vm, char* cstr);
sl_make_cstring(struct sl_vm* vm, const char* cstr);

sl_string_t*
sl_cstring(struct sl_vm* vm, char* cstr);
Expand Down
4 changes: 3 additions & 1 deletion inc/slash/vm.h
Expand Up @@ -143,7 +143,9 @@ typedef enum sl_vm_opcode {
SL_OP_CATCH,
SL_OP_YADA_YADA,
SL_OP_BIND_METHOD,
SL_OP_ADD
SL_OP_ADD,
SL_OP_USE,
SL_OP_USE_TOP_LEVEL
}
sl_vm_opcode_t;

Expand Down
5 changes: 5 additions & 0 deletions lib/slash/http.sl
@@ -0,0 +1,5 @@
<%
class HTTP {
}
3 changes: 1 addition & 2 deletions lib/slash/http/client.sl
@@ -1,7 +1,6 @@
<%
use URI;
use HTTP::Client;
class HTTP {
class Client {
Expand Down Expand Up @@ -69,4 +68,4 @@ class HTTP {
}
}
}
}
}
16 changes: 15 additions & 1 deletion platform/posix.c
Expand Up @@ -39,6 +39,20 @@ sl_file_exists(sl_vm_t* vm, char* path)
return !stat(sl_realpath(vm, path), &s);
}

sl_file_type_t
sl_file_type(struct sl_vm* vm, char* path)
{
struct stat s;
if(stat(sl_realpath(vm, path), &s)) {
return SL_FT_NO_EXIST;
}
if(S_ISDIR(s.st_mode)) {
return SL_FT_DIR;
} else {
return SL_FT_FILE;
}
}

int sl_abs_file_exists(char* path)
{
struct stat s;
Expand Down Expand Up @@ -72,7 +86,7 @@ int sl_seed()
char**
sl_environ(struct sl_vm* vm)
{
return environ;
return __environ;
(void)vm;
}
#endif
16 changes: 15 additions & 1 deletion platform/win32.c
Expand Up @@ -34,7 +34,21 @@ int
sl_file_exists(sl_vm_t* vm, char* path)
{
DWORD dwAttrib = GetFileAttributes(sl_realpath(vm, path));
return (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
return dwAttrib != INVALID_FILE_ATTRIBUTES;
}

sl_file_type_t
sl_file_type(struct sl_vm* vm, char* path
{
DWORD attrib = GetFileAttributes(sl_realpath(vm, path));
if(attrib == INVALID_FILE_ATTRIBUTES) {
return SL_FT_NO_EXIST;
}
if(attrib & FILE_ATTRIBUTE_DIRECTORY) {
return SL_FT_DIR;
} else {
return SL_FT_FILE;
}
}

int
Expand Down
6 changes: 4 additions & 2 deletions sapi/apache2/Makefile
@@ -1,3 +1,5 @@
include ../../local.mk

.PHONY: clean install uninstall

APR=apr-1
Expand All @@ -9,7 +11,7 @@ mod_slash.so: .libs/mod_slash.so
cp $< $@

.libs/mod_slash.so: mod_slash.c ../../libslash.a
$(APXS) -n mod_slash "-Wc,$(CFLAGS)" "-Wl,$(LDFLAGS)" -c $< "-Wl,$(LDFLAGS)"
CC=$(CC) $(APXS) -n mod_slash "-Wc,$(CFLAGS)" "-Wl,$(LDFLAGS)" -c $< "-Wl,$(LDFLAGS)"

clean:
rm -f *.o *.so *.$(SO_EXT)
Expand All @@ -18,4 +20,4 @@ clean:
install:
$(APXS) -i -a mod_slash.so

uninstall:
uninstall:
2 changes: 1 addition & 1 deletion sapi/apache2/mod_slash.c
Expand Up @@ -126,7 +126,7 @@ run_slash_script(request_rec* r, void* stack_top)
{
sl_vm_t* vm;
slash_context_t ctx;
sl_catch_frame_t exit_frame, exception_frame;
sl_vm_frame_t exit_frame, exception_frame;
char* last_slash;
SLVAL error;
sl_static_init();
Expand Down
1 change: 0 additions & 1 deletion sapi/fcgi/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions sapi/fcgi/Makefile

This file was deleted.

9 changes: 0 additions & 9 deletions sapi/fcgi/configure.pl

This file was deleted.

0 comments on commit 3fea5e8

Please sign in to comment.