automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-commit] [SCM] GNU Automake branch, master, updated. Release-1-


From: Ralf Wildenhues
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. Release-1-10-211-gbe6de49
Date: Sun, 26 Oct 2008 19:39:56 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=be6de492fc71c2249e6d080a3e5050a4e0ad4334

The branch, master has been updated
       via  be6de492fc71c2249e6d080a3e5050a4e0ad4334 (commit)
      from  3fd0df9b84cdc9106907e4662103747838251f1c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit be6de492fc71c2249e6d080a3e5050a4e0ad4334
Author: Ralf Wildenhues <address@hidden>
Date:   Sun Oct 26 20:38:06 2008 +0100

    Implement serialization for Locations.
    
    * lib/Automake/Location.pm (serialize, deserialize): New
    functions.  They allows to serialize a Location in an array, and
    to restore a Location from a thread queue.  The API is
    unsymmetric (array vs. queue) because enqueuing data needs to
    happen atomically.
    
    Signed-off-by: Ralf Wildenhues <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |    7 +++++++
 lib/Automake/Location.pm |   36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index de78a03..10b0b5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-10-26  Ralf Wildenhues  <address@hidden>
 
+       Implement serialization for Locations.
+       * lib/Automake/Location.pm (serialize, deserialize): New
+       functions.  They allows to serialize a Location in an array, and
+       to restore a Location from a thread queue.  The API is
+       unsymmetric (array vs. queue) because enqueuing data needs to
+       happen atomically.
+
        Parallel automake: ordered output messages.
        * lib/Automake/Channels.pm (%_default_options): New options
        `ordered' default enabled, `queue', default zero (no queue),
diff --git a/lib/Automake/Location.pm b/lib/Automake/Location.pm
index 33f526a..90534f1 100644
--- a/lib/Automake/Location.pm
+++ b/lib/Automake/Location.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2008  Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -57,6 +57,13 @@ Automake::Location - a class for location tracking, with a 
stack of contexts
   # that would otherwise be modified.
   my $where_copy = $where->clone;
 
+  # Serialize a Location object (for passing through a thread queue,
+  # for example)
+  my @array = $where->serialize ();
+
+  # De-serialize: recreate a Location object from a queue.
+  my $where = new Automake::Location::deserialize ($queue);
+
 =head1 DESCRIPTION
 
 C<Location> objects are used to keep track of locations in Automake,
@@ -145,6 +152,33 @@ sub dump ($)
   return $res;
 }
 
+sub serialize ($)
+{
+  my ($self) = @_;
+  my @serial = ();
+  push @serial, $self->get;
+  my @contexts = $self->get_contexts;
+  for my $pair (@contexts)
+    {
+      push @serial, @{$pair};
+    }
+  push @serial, undef;
+  return @serial;
+}
+
+sub deserialize ($)
+{
+  my ($queue) = @_;
+  my $position = $queue->dequeue ();
+  my $self = new Automake::Location $position;
+  while (my $position = $queue->dequeue ())
+    {
+      my $context = $queue->dequeue ();
+      push @{$self->{'contexts'}}, [$position, $context];
+    }
+  return $self;
+}
+
 =head1 SEE ALSO
 
 L<Automake::Channels>


hooks/post-receive
--
GNU Automake




reply via email to

[Prev in Thread] Current Thread [Next in Thread]