Index: uspace/app/sbi/src/builtin/bi_string.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_string.c	(revision 5e984f296b2eda2b4b5d68452cfbc8c1134ca2c7)
+++ uspace/app/sbi/src/builtin/bi_string.c	(revision 5e984f296b2eda2b4b5d68452cfbc8c1134ca2c7)
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @file String builtin binding. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "../bigint.h"
+#include "../builtin.h"
+#include "../debug.h"
+#include "../mytypes.h"
+#include "../os/os.h"
+#include "../rdata.h"
+#include "../run.h"
+#include "../strtab.h"
+
+#include "bi_string.h"
+
+static void bi_string_length(run_t *run);
+static void bi_string_slice(run_t *run);
+
+/** Declare String builtin.
+ *
+ * @param bi	Builtin object
+ */
+void bi_string_declare(builtin_t *bi)
+{
+	(void) bi;
+}
+
+/** Bind String builtin.
+ *
+ * @param bi	Builtin object
+ */
+void bi_string_bind(builtin_t *bi)
+{
+	builtin_fun_bind(bi, "String", "get_length", bi_string_length);
+	builtin_fun_bind(bi, "String", "Slice", bi_string_slice);
+}
+
+/** Return length of the string.
+ *
+ * @param run	Runner object
+ */
+static void bi_string_length(run_t *run)
+{
+        rdata_var_t *self_value_var;
+        const char *str;
+        size_t str_l;
+
+	rdata_int_t *rint;
+	rdata_var_t *rvar;
+	rdata_value_t *rval;
+	rdata_item_t *ritem;
+
+	run_proc_ar_t *proc_ar;
+
+	/* Extract self.Value */
+	self_value_var = builtin_get_self_mbr_var(run, "Value");
+	assert(self_value_var->vc == vc_string);
+	str = self_value_var->u.string_v->value;
+	str_l = os_str_length(str);
+
+#ifdef DEBUG_RUN_TRACE
+	printf("Get length of string '%s'.\n", str);
+#endif
+
+	/* Construct return value. */
+	rint = rdata_int_new();
+	bigint_init(&rint->value, (int) str_l);
+
+	rvar = rdata_var_new(vc_int);
+	rvar->u.int_v = rint;
+	rval = rdata_value_new();
+	rval->var = rvar;
+
+	ritem = rdata_item_new(ic_value);
+	ritem->u.value = rval;
+
+	proc_ar = run_get_current_proc_ar(run);
+	proc_ar->retval = ritem;
+}
+
+/** Return slice (substring) of the string.
+ *
+ * @param run	Runner object
+ */
+static void bi_string_slice(run_t *run)
+{
+        rdata_var_t *self_value_var;
+        const char *str;
+        size_t str_l;
+
+	rdata_var_t *start_var;
+	int start;
+
+	rdata_var_t *length_var;
+	int length;
+
+	int rc;
+
+	rdata_string_t *rstring;
+	rdata_var_t *rvar;
+	rdata_value_t *rval;
+	rdata_item_t *ritem;
+
+	run_proc_ar_t *proc_ar;
+
+	/* Extract self.Value */
+	self_value_var = builtin_get_self_mbr_var(run, "Value");
+	assert(self_value_var->vc == vc_string);
+	str = self_value_var->u.string_v->value;
+	str_l = os_str_length(str);
+
+	/* Get argument @a start. */
+	start_var = run_local_vars_lookup(run, strtab_get_sid("start"));
+	assert(start_var);
+	assert(start_var->vc == vc_int);
+
+	rc = bigint_get_value_int(&start_var->u.int_v->value, &start);
+	if (rc != EOK || start < 0 || (size_t) start > str_l) {
+		printf("Error: Parameter 'start' to Slice() out of range.\n");
+		exit(1);
+	}
+
+	/* Get argument @a length. */
+	length_var = run_local_vars_lookup(run, strtab_get_sid("length"));
+	assert(length_var);
+	assert(length_var->vc == vc_int);
+
+	rc = bigint_get_value_int(&length_var->u.int_v->value, &length);
+	if (rc != EOK || length < 0 || (size_t) (start + length) > str_l) {
+		printf("Error: Parameter 'length' to Slice() out of range.\n");
+		exit(1);
+	}
+
+#ifdef DEBUG_RUN_TRACE
+	printf("Construct Slice(%d, %d) from string '%s'.\n",
+	    start, length, str);
+#endif
+	/* Construct return value. */
+	rstring = rdata_string_new();
+	rstring->value = os_str_aslice(str, start, length);
+
+	rvar = rdata_var_new(vc_string);
+	rvar->u.string_v = rstring;
+	rval = rdata_value_new();
+	rval->var = rvar;
+
+	ritem = rdata_item_new(ic_value);
+	ritem->u.value = rval;
+
+	proc_ar = run_get_current_proc_ar(run);
+	proc_ar->retval = ritem;
+}
Index: uspace/app/sbi/src/builtin/bi_string.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_string.h	(revision 5e984f296b2eda2b4b5d68452cfbc8c1134ca2c7)
+++ uspace/app/sbi/src/builtin/bi_string.h	(revision 5e984f296b2eda2b4b5d68452cfbc8c1134ca2c7)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BI_STRING_H_
+#define BI_STRING_H_
+
+#include "../mytypes.h"
+
+void bi_string_declare(builtin_t *bi);
+void bi_string_bind(builtin_t *bi);
+
+#endif
Index: uspace/app/sbi/src/builtin/bi_textfile.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_textfile.c	(revision 38aaacc20a85af2361a0240ac2e7d643e086ecfa)
+++ uspace/app/sbi/src/builtin/bi_textfile.c	(revision 5e984f296b2eda2b4b5d68452cfbc8c1134ca2c7)
@@ -71,5 +71,5 @@
 			"fun WriteLine(line : string), builtin;\n"
 			"\n"
-			"prop EOF : int is\n"
+			"prop EOF : bool is\n"
 				"get is\n"
 					"return is_eof();\n"
@@ -77,5 +77,5 @@
 			"end\n"
 			"\n"
-			"fun is_eof() : int, builtin;\n"
+			"fun is_eof() : bool, builtin;\n"
 		"end\n");
 
@@ -342,6 +342,6 @@
         rdata_var_t *self_f_var;
 
-	int eof_flag;
-	rdata_int_t *eof_int;
+	bool_t eof_flag;
+	rdata_bool_t *eof_bool;
 	rdata_var_t *eof_var;
 	rdata_value_t *eof_val;
@@ -362,15 +362,15 @@
 	/* Get status of EOF flag. */
 
-	eof_flag = feof(file) ? 1 : 0;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Read EOF flag '%d'.\n", eof_flag);
+	eof_flag = feof(file) ? b_true : b_false;
+
+#ifdef DEBUG_RUN_TRACE
+	printf("Read EOF flag '%s'.\n", eof_flag ? "true" : "false");
 #endif
 	/* Construct return value. */
-	eof_int = rdata_int_new();
-	bigint_init(&eof_int->value, eof_flag);
-
-	eof_var = rdata_var_new(vc_int);
-	eof_var->u.int_v = eof_int;
+	eof_bool = rdata_bool_new();
+	eof_bool->value = eof_flag;
+
+	eof_var = rdata_var_new(vc_bool);
+	eof_var->u.bool_v = eof_bool;
 	eof_val = rdata_value_new();
 	eof_val->var = eof_var;
