Browse Source

Debug revision. Don't use

git-svn-id: https://klish.googlecode.com/svn/trunk@317 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
01ee0792ed
4 changed files with 31 additions and 9 deletions
  1. 2 0
      clish/command/command_dump.c
  2. 13 1
      clish/nspace/nspace.c
  3. 3 0
      clish/variable/variable_expand.c
  4. 13 8
      clish/view/view.c

+ 2 - 0
clish/command/command_dump.c

@@ -14,6 +14,8 @@ void clish_command_dump(const clish_command_t * this)
 	lub_dump_indent();
 	lub_dump_printf("name        : %s\n", this->name);
 	lub_dump_printf("text        : %s\n", this->text);
+	lub_dump_printf("link        : %s\n",
+		this->link ? clish_command__get_name(this->link) : "(null)");
 	lub_dump_printf("alias       : %s\n", this->alias);
 	lub_dump_printf("alias_view  : %s\n",
 		this->alias_view ? clish_view__get_name(this->alias_view) : "(null)");

+ 13 - 1
clish/nspace/nspace.c

@@ -18,7 +18,6 @@
  *--------------------------------------------------------- */
 static void clish_nspace_init(clish_nspace_t * this, clish_view_t * view)
 {
-
 	this->view = view;
 
 	/* set up defaults */
@@ -199,7 +198,20 @@ clish_command_t *clish_nspace_find_command(clish_nspace_t * this, const char *na
 		}
 	}
 
+printf("real_prefix=%s cmd=%s\n", real_prefix, cmd ? clish_command__get_name(cmd): NULL);
+if (cmd) {
+	printf("Pre cmd:\n");
+	clish_command_dump(cmd);
+}
 	retval = clish_nspace_find_create_command(this, real_prefix, cmd);
+if (retval) {
+	printf("Retval\n");
+	clish_command_dump(retval);
+if (cmd) {
+	printf("Post cmd:\n");
+	clish_command_dump(cmd);
+}
+}
 	lub_string_free(real_prefix);
 
 	return retval;

+ 3 - 0
clish/variable/variable_expand.c

@@ -66,6 +66,9 @@ static char *find_context_var(const context_t * this, const char *name)
 	} else if (!lub_string_nocasecmp(name, "__cmd")) {
 		result = lub_string_dup(clish_command__get_name(
 			clish_command__get_orig(this->cmd)));
+	} else if (!lub_string_nocasecmp(name, "__orig_cmd")) {
+		result = lub_string_dup(clish_command__get_name(
+			clish_command__get_orig(this->cmd)));
 	} else if (!lub_string_nocasecmp(name, "__line")) {
 		if (this->pargv)
 			result = clish_variable__get_line(this->cmd, this->pargv);

+ 13 - 8
clish/view/view.c

@@ -229,18 +229,23 @@ clish_command_t *clish_view_find_command(clish_view_t * this, const char *name,
 			link = NULL;
 		}
 		result = link;
+printf("!!!!!!!!!!! transform %s\n", clish_command__get_name(result));
 	}
 
-	if (!inherit)
-		return result;
-
-	for (i = cnt - 1; i >= 0; i--) {
-		nspace = clish_view__get_nspace(this, i);
-		cmd = clish_nspace_find_command(nspace, name);
-		/* choose the longest match */
-		result = clish_command_choose_longest(result, cmd);
+	if (inherit) {
+		for (i = cnt - 1; i >= 0; i--) {
+			nspace = clish_view__get_nspace(this, i);
+			cmd = clish_nspace_find_command(nspace, name);
+			/* choose the longest match */
+			result = clish_command_choose_longest(result, cmd);
+		}
 	}
 
+//	if (result && clish_command__get_alias(result)) {
+//		printf("Sam link\n");
+//		clish_command_dump(result);
+//	}
+
 	return result;
 }