rev 751 - in trunk: modules/OS src
SVN User <[email protected]> Sun, 18 Jul 2004 10:21:47 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bcollins
Date: 2004-07-18 10:21:44 -0400 (Sun, 18 Jul 2004)
New Revision: 751
Modified:
trunk/modules/OS/OS.c
trunk/src/Makefile.in
trunk/src/interp.c
trunk/src/prothon.y
Log:
Get rid of a lot of compile warnings. Fix prothon.y, which got converted
to partial msdos file format.
Modified: trunk/modules/OS/OS.c
===================================================================
--- trunk/modules/OS/OS.c 2004-07-18 08:34:02 UTC (rev 750)
+++ trunk/modules/OS/OS.c 2004-07-18 14:21:44 UTC (rev 751)
@@ -127,7 +127,10 @@
#define MAX_ARGV_ARGS 128
#define MAX_ENV_VARS 512
+/* This is the wrong way to do things */
+#ifndef SIGKILL
#define SIGKILL 11 // stolen from APR private.h, is this right???
+#endif
DEF(Process, init_, FPARM4(argV, OBJ(NODEF), flags, NEW_INT(0), workDir, OBJ(NONE), env, OBJ(NONE))) {
apr_status_t aprerr;
@@ -219,7 +222,9 @@
DATA_SIZE(self) = (data_size_t) sizeof(proc_t);
procp->pool = pool;
- aprerr = apr_proc_create(&procp->proc, argv_arr[0], argv_arr, env_arr, attr, pool);
+ aprerr = apr_proc_create(&procp->proc, argv_arr[0],
+ (const char * const *)argv_arr,
+ (const char * const *)env_arr, attr, pool);
IF_APR_ERR("error in apr_proc_create") return NULL;
read_unlock(ist, self);
Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in 2004-07-18 08:34:02 UTC (rev 750)
+++ trunk/src/Makefile.in 2004-07-18 14:21:44 UTC (rev 751)
@@ -17,7 +17,7 @@
OBJS = main.o $(BUILTIN_MOD_OBJS) object.o argproc.o clist.o lock.o \
memory_mgr.o parser.o prmalloc.o sys.o interp.o parser_routines.o \
- symbol.o getline.o console.o pr_snprintf.o
+ symbol.o getline.o console.o pr_snprintf.o ob_malloc.o
all: $(TARGET)
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-07-18 08:34:02 UTC (rev 750)
+++ trunk/src/interp.c 2004-07-18 14:21:44 UTC (rev 751)
@@ -1423,7 +1423,7 @@
if (ist->exception_obj) goto end_op_obj;
}
op_obj_end:
- if (doc_str_obj = get_attr(ist, fr_data(1), SYM(DOC_)))
+ if ((doc_str_obj = get_attr(ist, fr_data(1), SYM(DOC_))))
set_attr(ist, new_obj, SYM(DOC_), doc_str_obj);
key = fr_stack[fr_sp+1];
#ifdef DUMP_MODULE_CODE
Modified: trunk/src/prothon.y
===================================================================
--- trunk/src/prothon.y 2004-07-18 08:34:02 UTC (rev 750)
+++ trunk/src/prothon.y 2004-07-18 14:21:44 UTC (rev 751)
@@ -75,14 +75,14 @@
#define state ((parse_state*) yylex_param)
#define IST (((parse_state*) yylex_param)->ist)
-#define TD new_string_obj(state->ist, "~")
-
-#define YYDEBUG 0
-#ifdef TRACE_PARSER
-#undef YYDEBUG
-#define YYDEBUG 1
-#define fout state->debug_stream
-#endif
+#define TD new_string_obj(state->ist, "~")
+
+#define YYDEBUG 0
+#ifdef TRACE_PARSER
+#undef YYDEBUG
+#define YYDEBUG 1
+#define fout state->debug_stream
+#endif
%}
/* BISON Declarations */
@@ -671,17 +671,21 @@
#include <ctype.h>
-void set_srcloc(isp ist, parse_state* stat, obj_p obj) {
- int immutable_flg;
- obj_p str_obj = new_string_n_obj(ist, stat->token_buf, stat->token_buf_ptr);
- stat->token_buf_ptr = 0;
- if (immutable_flg = is_immutable(obj));
- clr_immutable(obj);
- set_attr(ist, obj, SYM(SRCLOC_), str_obj);
- if (immutable_flg)
- set_immutable(obj);
-}
+void set_srcloc(isp ist, parse_state* stat, obj_p obj) {
+ int immutable_flg;
+ obj_p str_obj = new_string_n_obj(ist, stat->token_buf, stat->token_buf_ptr);
+ stat->token_buf_ptr = 0;
+
+ if ((immutable_flg = is_immutable(obj)));
+ clr_immutable(obj);
+
+ set_attr(ist, obj, SYM(SRCLOC_), str_obj);
+
+ if (immutable_flg)
+ set_immutable(obj);
+}
+
// special get character function
// automatically handle different format line ends (\r, \n, & \r\n -> \n)
// increment lines and columns for YYLTYPE in parser
@@ -798,76 +802,76 @@
else
ungetch(c2, state);
}
- if (c == '\n'){
- int llen = clist_len(state->indent_stack);
- level_mismatch = 0;
- unknown_indent_flag = 0;
- // if a ( { or [ is on top of indent stack then this is a continuation line
- if (clist_len(state->indent_stack) && clist_tos_num(state->indent_stack) > 0)
- continue;
- if (!state->indent_char) {
- if ((c=getch(state)) == '\t' || c == ' ') {
- int tmp_indent_char = c, new_chr_cnt = 1;
- while ((c=getch(state)) == tmp_indent_char) new_chr_cnt++;
- if (!state->last_line_colon) goto check_comment;
- state->indent_char = tmp_indent_char;
- clist_append_num(state->indent_stack, -new_chr_cnt);
- indent_cnt = 1;
- }
- } else {
- int chr_cnt;
- for(chr_cnt=0; (c=getch(state)) == state->indent_char; chr_cnt++) ;
- for (indent_cnt=0; chr_cnt > 0 && indent_cnt < llen; indent_cnt++)
- chr_cnt -= -clist_num(state->indent_stack, indent_cnt);
- if (chr_cnt < 0)
- level_mismatch = TRUE;
- else if (chr_cnt) {
- if (!state->last_line_colon) goto check_comment;
- indent_cnt++;
- clist_append_num(state->indent_stack, -chr_cnt);
- }
- }
- mixed_indents = ( (state->indent_char == '\t' && c == ' ') ||
- (state->indent_char == ' ' && c == '\t') );
- while (c == ' ' || c == '\t') c = getch(state);
- if (c == '\n' || c == '#')
- goto check_comment;
- if (c == '/') {
- int c2=getch(state);
- ungetch(c2, state);
- if (c2 == '*'){
- unknown_indent_flag = 1;
- goto check_comment;
- }
- }
- ungetch(c, state);
- if (level_mismatch) {
- printf("Lexical error: indentation level does not match any previous level\n");
- return ERR;
- }
- if (mixed_indents){
- printf("Lexical error: mixed tabs and spaces in indentation\n");
- return ERR;
- }
- state->indents_needed = indent_cnt - state->old_tab_count;
- state->old_tab_count = indent_cnt;
- while (clist_len(state->indent_stack) > indent_cnt) clist_pop(state->indent_stack);
- if (!indent_cnt) state->indent_char = 0;
- return EOL;
- }
- break;
- }
- if (c == EOF){
- if (state->old_tab_count) {
- state->indents_needed = 0 - state->old_tab_count;
- state->old_tab_count = 0;
- return EOL;
- } else if (!state->eof_flag) {
- state->eof_flag = 1;
- return EOL;
- } else
- return 0; // EOF
- }
+ if (c == '\n'){
+ int llen = clist_len(state->indent_stack);
+ level_mismatch = 0;
+ unknown_indent_flag = 0;
+ // if a ( { or [ is on top of indent stack then this is a continuation line
+ if (clist_len(state->indent_stack) && clist_tos_num(state->indent_stack) > 0)
+ continue;
+ if (!state->indent_char) {
+ if ((c=getch(state)) == '\t' || c == ' ') {
+ int tmp_indent_char = c, new_chr_cnt = 1;
+ while ((c=getch(state)) == tmp_indent_char) new_chr_cnt++;
+ if (!state->last_line_colon) goto check_comment;
+ state->indent_char = tmp_indent_char;
+ clist_append_num(state->indent_stack, -new_chr_cnt);
+ indent_cnt = 1;
+ }
+ } else {
+ int chr_cnt;
+ for(chr_cnt=0; (c=getch(state)) == state->indent_char; chr_cnt++) ;
+ for (indent_cnt=0; chr_cnt > 0 && indent_cnt < llen; indent_cnt++)
+ chr_cnt -= -clist_num(state->indent_stack, indent_cnt);
+ if (chr_cnt < 0)
+ level_mismatch = TRUE;
+ else if (chr_cnt) {
+ if (!state->last_line_colon) goto check_comment;
+ indent_cnt++;
+ clist_append_num(state->indent_stack, -chr_cnt);
+ }
+ }
+ mixed_indents = ( (state->indent_char == '\t' && c == ' ') ||
+ (state->indent_char == ' ' && c == '\t') );
+ while (c == ' ' || c == '\t') c = getch(state);
+ if (c == '\n' || c == '#')
+ goto check_comment;
+ if (c == '/') {
+ int c2=getch(state);
+ ungetch(c2, state);
+ if (c2 == '*'){
+ unknown_indent_flag = 1;
+ goto check_comment;
+ }
+ }
+ ungetch(c, state);
+ if (level_mismatch) {
+ printf("Lexical error: indentation level does not match any previous level\n");
+ return ERR;
+ }
+ if (mixed_indents){
+ printf("Lexical error: mixed tabs and spaces in indentation\n");
+ return ERR;
+ }
+ state->indents_needed = indent_cnt - state->old_tab_count;
+ state->old_tab_count = indent_cnt;
+ while (clist_len(state->indent_stack) > indent_cnt) clist_pop(state->indent_stack);
+ if (!indent_cnt) state->indent_char = 0;
+ return EOL;
+ }
+ break;
+ }
+ if (c == EOF){
+ if (state->old_tab_count) {
+ state->indents_needed = 0 - state->old_tab_count;
+ state->old_tab_count = 0;
+ return EOL;
+ } else if (!state->eof_flag) {
+ state->eof_flag = 1;
+ return EOL;
+ } else
+ return 0; // EOF
+ }
if (unknown_indent_flag) {
printf("Lexical error: Inline quote not allowed at beginning of indented line\n");
return ERR;
@@ -877,7 +881,7 @@
if (c == 'r' || c == 'R' || c == 'x' || c == 'X' || c == '\'' || c == '\"') {
int r_flag=0, x_flag=0, triple_flag=0, q_char=c;
int str_index=0, cur_size=INITIAL_STRING_ALLOC;
- char* str_ptr = pr_malloc(cur_size);
+ char* str_ptr = pr_malloc(cur_size);
if (c == 'r' || c == 'R') {
if ((q_char=getch(state)) == '\'' || q_char == '\"' )
r_flag = 1;
@@ -1013,10 +1017,10 @@
lvalp->str_type = new_bytes_obj(IST, str_ptr, str_index-1);
else
lvalp->str_type = new_string_n_obj(IST, str_ptr, str_index-1);
- set_srcloc(IST, yylex_param, lvalp->str_type);
-#ifdef TRACE_PARSER
- if (trace_parser){
- fprintf(((parse_state*) yylex_param)->debug_stream, "\"%s\"\n",str_ptr);
+ set_srcloc(IST, yylex_param, lvalp->str_type);
+#ifdef TRACE_PARSER
+ if (trace_parser){
+ fprintf(((parse_state*) yylex_param)->debug_stream, "\"%s\"\n",str_ptr);
}
#endif
return STRING;
@@ -1155,7 +1159,7 @@
/* process LABEL or english keyword*/
if (c == '_' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ) {
int str_index=0, cur_size=INITIAL_STRING_ALLOC;
- char* str_ptr = pr_malloc(cur_size);
+ char* str_ptr = pr_malloc(cur_size);
add_string(c, &str_ptr, &str_index, &cur_size);
while ((c=getch(state)) == '_' || c == '!' || c == '?' ||
(c >= '0' && c <= '9') ||
@@ -1204,10 +1208,10 @@
str_ptr = pr_realloc(str_ptr, str_index);
lvalp->str_type = new_string_n_obj(IST, str_ptr, str_index-1);
- set_srcloc(IST, yylex_param, lvalp->str_type);
-#ifdef TRACE_PARSER
- if (trace_parser){
- fprintf(((parse_state*) yylex_param)->debug_stream, "\"%s\"\n",str_ptr);
+ set_srcloc(IST, yylex_param, lvalp->str_type);
+#ifdef TRACE_PARSER
+ if (trace_parser){
+ fprintf(((parse_state*) yylex_param)->debug_stream, "\"%s\"\n",str_ptr);
}
#endif
return LABEL;
@@ -1217,7 +1221,7 @@
int imag_flag=0, nonzero_flag=0, past_e_flag=0;
int octal_flag=0, hex_flag=0, int_dot_flag=0;
int str_index=0, cur_size=INITIAL_STRING_ALLOC;
- char* str_ptr = pr_malloc(cur_size);
+ char* str_ptr = pr_malloc(cur_size);
add_string(c, &str_ptr, &str_index, &cur_size);
if (c == '.') {
@@ -1257,52 +1261,52 @@
ungetch(c, state);
c = '.';
}
- if (octal_flag || hex_flag || int_dot_flag || (c != '.' && c != 'e' && c != 'E')){
- if (imag_flag)
- str_index--;
- else
- ungetch(c, state);
- str_ptr[str_index++] = 0;
- if (hex_flag) {
- long_p longp = cstr2longp(IST, str_ptr+2, NULL, 16);
- if (IST->exception_obj) {
- IST->exception_obj = NULL;
- printf("Lexical error: invalid hex number\n");
- return ERR;
- }
- lvalp->int_type = new_int_long_obj(IST, longp);
- } else if (octal_flag) {
- long_p longp = cstr2longp(IST, str_ptr+2, NULL, 8);
- if (IST->exception_obj) {
- IST->exception_obj = NULL;
- printf("Lexical error: invalid octal number\n");
- return ERR;
- }
- lvalp->int_type = new_int_long_obj(IST, longp);
- } else {
- if (strlen(str_ptr) < 16)
- lvalp->int_type = new_int_obj(IST, apr_atoi64(str_ptr));
- else {
- long_p longp = cstr2longp(IST, str_ptr, NULL, 10);
- if (IST->exception_obj) {
- IST->exception_obj = NULL;
- printf("Lexical error: invalid integer number\n");
- return ERR;
- }
- lvalp->int_type = new_int_long_obj(IST, longp);
- }
- }
- if (nonzero_flag && int_is_zero(lvalp->int_type)){
- printf("Lexical error: invalid integer number format\n");
- return ERR;
- }
- set_srcloc(IST, yylex_param, lvalp->int_type);
- if (imag_flag)
- return INT_IMAG;
- else
- return INT_;
- }
- }
+ if (octal_flag || hex_flag || int_dot_flag || (c != '.' && c != 'e' && c != 'E')){
+ if (imag_flag)
+ str_index--;
+ else
+ ungetch(c, state);
+ str_ptr[str_index++] = 0;
+ if (hex_flag) {
+ long_p longp = cstr2longp(IST, str_ptr+2, NULL, 16);
+ if (IST->exception_obj) {
+ IST->exception_obj = NULL;
+ printf("Lexical error: invalid hex number\n");
+ return ERR;
+ }
+ lvalp->int_type = new_int_long_obj(IST, longp);
+ } else if (octal_flag) {
+ long_p longp = cstr2longp(IST, str_ptr+2, NULL, 8);
+ if (IST->exception_obj) {
+ IST->exception_obj = NULL;
+ printf("Lexical error: invalid octal number\n");
+ return ERR;
+ }
+ lvalp->int_type = new_int_long_obj(IST, longp);
+ } else {
+ if (strlen(str_ptr) < 16)
+ lvalp->int_type = new_int_obj(IST, apr_atoi64(str_ptr));
+ else {
+ long_p longp = cstr2longp(IST, str_ptr, NULL, 10);
+ if (IST->exception_obj) {
+ IST->exception_obj = NULL;
+ printf("Lexical error: invalid integer number\n");
+ return ERR;
+ }
+ lvalp->int_type = new_int_long_obj(IST, longp);
+ }
+ }
+ if (nonzero_flag && int_is_zero(lvalp->int_type)){
+ printf("Lexical error: invalid integer number format\n");
+ return ERR;
+ }
+ set_srcloc(IST, yylex_param, lvalp->int_type);
+ if (imag_flag)
+ return INT_IMAG;
+ else
+ return INT_;
+ }
+ }
if (imag_flag)
str_index--;
else {
@@ -1327,7 +1331,7 @@
return ERR;
}
lvalp->float_type = new_float_obj(IST, floatval);
- set_srcloc(IST, yylex_param, lvalp->float_type);
+ set_srcloc(IST, yylex_param, lvalp->float_type);
if (imag_flag)
return FLOAT_IMAG;
else