~jsvoboda/helenos/sysel

« back to all changes in this revision

Viewing changes to uspace/app/sbi/src/builtin/bi_string.c

  • Committer: Jiri Svoboda
  • Date: 2010-06-09 19:01:08 UTC
  • Revision ID: jiri@wiwaxia-20100609190108-0q5s6iwfyy7481a8
Update SBI to rev. 291.

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
{
116
116
        rdata_var_t *self_value_var;
117
117
        const char *str;
 
118
        const char *slice;
118
119
        size_t str_l;
119
120
 
120
121
        rdata_var_t *start_var;
125
126
 
126
127
        int rc;
127
128
 
128
 
        rdata_string_t *rstring;
129
 
        rdata_var_t *rvar;
130
 
        rdata_value_t *rval;
131
 
        rdata_item_t *ritem;
132
 
 
133
 
        run_proc_ar_t *proc_ar;
134
 
 
135
129
        /* Extract self.Value */
136
130
        self_value_var = builtin_get_self_mbr_var(run, "Value");
137
131
        assert(self_value_var->vc == vc_string);
164
158
        printf("Construct Slice(%d, %d) from string '%s'.\n",
165
159
            start, length, str);
166
160
#endif
167
 
        /* Construct return value. */
168
 
        rstring = rdata_string_new();
169
 
        rstring->value = os_str_aslice(str, start, length);
170
 
 
171
 
        rvar = rdata_var_new(vc_string);
172
 
        rvar->u.string_v = rstring;
173
 
        rval = rdata_value_new();
174
 
        rval->var = rvar;
175
 
 
176
 
        ritem = rdata_item_new(ic_value);
177
 
        ritem->u.value = rval;
178
 
 
179
 
        proc_ar = run_get_current_proc_ar(run);
180
 
        proc_ar->retval = ritem;
 
161
        slice = os_str_aslice(str, start, length);
 
162
 
 
163
        /* Ownership of slice is transferred. */
 
164
        builtin_return_string(run, slice);
181
165
}