jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: pop_spot(0)


On Tue, Jul 08, 2003 at 10:35:12AM -0400, John E. Davis wrote:
> Klaus Schmid <klaus.schmid@xxxxxx> wrote:
> >Reading the docs I fear I do not understand the user-mark mechanics
> >completly, especially move_user_marks.
... 
> A user-mark is passed by reference.  Hence, any changes to it by a
> function will manifest itself outside the function. 

m = cerate_user_mark() - creates a new mark and attaches to variable m
                         (replacing its old value, which can be everything,
			  especially, it can also be a user_mark in another 
			  buffer)

move_user_mark(m)      - changes value of existing variable m
                       - cannot move mark into another buffer
		       - changes value of all attached variables
		       - slightly faster

Examples:

% a function moving the mark (fails, if called from another buffer)
define fun1 (m)
{
   move_user_mark (m);
}
% a function redefining the mark (doesnot work)
define fun2 (m)
{
   m = create_user_mark();
}

eob ();
% m can be of any type, the old value gets overwritten
variable m1 = 0;  
m1 = create_user_mark ();
variable m2 = m1;
bob ();
fun1(m1); % m1 _and_ m2 moved to bob
eob ();
fun2(m1); % m1 and m2 still at bob

m1 = create_user_mark();  % m1 at eob, m2 still at bob

% timing
variable t1, t2, n = 100000;
tic;
loop(n)
{
   bob();
   m1 = create_user_mark();
   eob();
}
t1 = toc();

tic;
loop(n)
{
   bob();
   move_user_mark(m1);
   eob();
}
t2 = toc();
vmessage("create_user_mark: %f s, move_user_mark: %f s bei n=%d", 
          t1, t2, n);
	  
	  
Günter
	  
-- 
Milde at ife.et.tu-dresden.de

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2003 date index] [2003 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]