diff --git a/lib/0.6/modules/Array.pmod b/lib/0.6/modules/Array.pmod new file mode 100644 index 0000000000000000000000000000000000000000..83900b91ad22a2bc125b4b79204d83663f11f6c6 --- /dev/null +++ b/lib/0.6/modules/Array.pmod @@ -0,0 +1,11 @@ +#pike 7.0 + +inherit Array; + +/* break too strict type handling... :) */ +array map(array x, int|string|function fun, mixed ... args) +{ + return Array.map(x,fun,@args); +} + + diff --git a/lib/0.6/modules/__default.pmod b/lib/0.6/modules/__default.pmod new file mode 100644 index 0000000000000000000000000000000000000000..3f74dc5e61d93d5377f7f678d9efa678ad53ab4c --- /dev/null +++ b/lib/0.6/modules/__default.pmod @@ -0,0 +1,18 @@ +/* Compatibility module */ + +#pike 7.0 + +/* compatibility: this destroys too strict type checking */ +array(mixed) aggregate(mixed ... args) +{ + return args; +} + +mapping(string:mixed) all_constants() +{ + mapping(string:mixed) ret=predef::all_constants()+([]); + + foreach(indices(this_object()), string id) ret[id]=::`->(id); + + return ret; +} diff --git a/lib/0.6/modules/readline.pmod b/lib/0.6/modules/readline.pmod new file mode 100644 index 0000000000000000000000000000000000000000..3e229cbbd5984223758fd02922a3c63c8e9014c4 --- /dev/null +++ b/lib/0.6/modules/readline.pmod @@ -0,0 +1,42 @@ +#pike 7.1 +import Stdio; +import Readline; + +static private object(History) readline_history = History(512); + +string _module_value(string prompt, function|void complete_callback) +{ + object rl = Readline(); + rl->enable_history(readline_history); + rl->set_prompt(prompt); + if(complete_callback) + rl->get_input_controller()-> + bind("^I", lambda() { + array(string) compl = ({ }); + string c, buf = rl->gettext(); + int st = 0, point = rl->getcursorpos(); + int wordstart = search(replace(reverse(buf), + ({"\t","\r","\n"}), + ({" "," "," "})), + " ", sizeof(buf)-point); + string word = buf[(wordstart>=0 && sizeof(buf)-wordstart).. + point-1]; + while((c = complete_callback(word, st++, buf, point))) + compl += ({ c }); + switch(sizeof(compl)) { + case 0: + break; + case 1: + rl->delete(point-sizeof(word), point); + rl->insert(compl[0], point-sizeof(word)); + rl->setcursorpos(point-sizeof(word)+sizeof(compl[0])); + break; + default: + rl->list_completions(compl); + break; + } + }); + string res = rl->read(); + destruct(rl); + return res; +} diff --git a/lib/master.pike.in b/lib/master.pike.in index 5ea377cb0d36ee53de7ce21ca7775164288f1201..920c104b44f714c71ae3f49245275219a3d970cf 100644 --- a/lib/master.pike.in +++ b/lib/master.pike.in @@ -1,6 +1,6 @@ /* -*- Pike -*- * - * $Id: master.pike.in,v 1.132 2000/09/26 18:58:56 hubbe Exp $ + * $Id: master.pike.in,v 1.133 2000/09/26 22:19:00 hubbe Exp $ * * Master-file for Pike. * @@ -948,9 +948,10 @@ class CompatResolver mixed resolv_base(string identifier, string|void current_file) { array(mixed) tmp = ({}); + string dir=current_file ? dirname(current_file) : "/"; foreach(pike_module_path, string path) { - string file=combine_path(path,identifier); + string file=combine_path(dir ,path,identifier); if(mixed ret=findmodule(file)) { if ((objectp(ret)) && (ret->is_resolv_dirnode || ret->is_resolv_joinnode)) { @@ -993,7 +994,7 @@ class CompatResolver if( !zero_type (ret = resolv_cache[id]) ) return ret == ZERO_TYPE ? UNDEFINED : resolv_cache[id]; array(string) tmp=identifier/"."; - ret=resolv_base(tmp[0]); + ret=resolv_base(tmp[0],current_file); foreach(tmp[1..],string index) ret=ret[index]; resolv_cache[id] = zero_type (ret) ? ZERO_TYPE : ret; return ret; @@ -1966,7 +1967,7 @@ class Version minor=min; } -#define CMP(X) (major - (X)->major) || (minor - (X)->minor) +#define CMP(X) ((major - (X)->major) || (minor - (X)->minor)) int `<(Version v) { return CMP(v) < 0; } int `>(Version v) { return CMP(v) > 0; } @@ -2049,28 +2050,28 @@ CompatResolver get_compilation_handler(int major, int minor) #endif ret=CompatResolver(v); - if( v < Version(0,6)) - ret->pike_module_path+=({"."}); + /* Add default paths */ + ret->pike_module_path=pike_module_path; + ret->pike_include_path=pike_include_path; - foreach(available, Version v) + foreach(reverse(available), Version tmp) { string base; #if "�lib_prefix�"[0]!='�' - base=combine_path("�lib_prefix�",sprintf("%s",v)); + base=combine_path("�lib_prefix�",sprintf("%s",tmp)); ret->add_module_path(combine_path(base,"modules")); ret->add_include_path(combine_path(base,"include")); #endif #if "�share_prefix�"[0]!='�' - base=combine_path("�share_prefix�",sprintf("%s",v)); + base=combine_path("�share_prefix�",sprintf("%s",tmp)); ret->add_module_path(combine_path(base,"modules")); ret->add_include_path(combine_path(base,"include")); #endif } - /* Add default paths */ - map(pike_module_path,ret->add_module_path); - map(pike_include_path,ret->add_include_path); + if( v <= Version(0,6)) + ret->pike_module_path+=({"."}); compat_handler_cache[v] = ret; diff --git a/src/docode.c b/src/docode.c index 8230f302015980e6d1bcea40ce2321acb953a994..8f4d879fd17025d84ac4240f8bc25fc3562992d6 100644 --- a/src/docode.c +++ b/src/docode.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: docode.c,v 1.82 2000/09/11 18:42:25 grubba Exp $"); +RCSID("$Id: docode.c,v 1.83 2000/09/26 22:19:02 hubbe Exp $"); #include "las.h" #include "program.h" #include "pike_types.h" @@ -1028,7 +1028,7 @@ static int do_docode2(node *n, INT16 flags) if(!is_const(lower)) yyerror("Case label isn't constant."); - if (lower && lower->type) { + if (lower && lower->type && !TEST_COMPAT(0,6)) { if (!pike_types_le(lower->type, current_switch_type)) { if (!match_types(lower->type, current_switch_type)) { yytype_error("Type mismatch in case.", diff --git a/src/language.yacc b/src/language.yacc index 26481381a9ae41ce729b5ce262ae6434d4d7c042..c35a673a01c4881681762ca1f6ec05e8ac01f80b 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -110,7 +110,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.213 2000/09/26 00:17:45 hubbe Exp $"); +RCSID("$Id: language.yacc,v 1.214 2000/09/26 22:19:03 hubbe Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -2365,7 +2365,8 @@ expected_colon: ':' return: TOK_RETURN { - if(!match_types(Pike_compiler->compiler_frame->current_return_type, + if(!TEST_COMPAT(0,6) && + !match_types(Pike_compiler->compiler_frame->current_return_type, void_type_string)) { yyerror("Must return a value for a non-void function."); diff --git a/src/las.c b/src/las.c index 78f48c400c54f4b9be4bb1f532b82549c51bc308..be532e26da2a72c7cbc9fe21b9276bd726976596 100644 --- a/src/las.c +++ b/src/las.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: las.c,v 1.215 2000/09/22 12:57:11 grubba Exp $"); +RCSID("$Id: las.c,v 1.216 2000/09/26 22:19:03 hubbe Exp $"); #include "language.h" #include "interpret.h" @@ -3087,6 +3087,12 @@ void fix_type_field(node *n) if(max_args < args) { + if(TEST_COMPAT(0,6)) + { + free_string(s); + copy_shared_string(n->type, mixed_type_string); + break; + } my_yyerror("Too many arguments to %s.",name); } else if(max_correct_args == args) @@ -3199,7 +3205,7 @@ void fix_type_field(node *n) break; case F_CASE: - if (CDR(n) && CAR(n)) { + if (CDR(n) && CAR(n) && !TEST_COMPAT(0,6)) { /* case 1 .. 2: */ if (!match_types(CAR(n)->type, CDR(n)->type)) { if (!match_types(CAR(n)->type, int_type_string) ||