pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp/src/data value.c value.h [simpler-proc]


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/src/data value.c value.h [simpler-proc]
Date: Sun, 22 Apr 2007 20:28:51 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Branch:         simpler-proc
Changes by:     Ben Pfaff <blp> 07/04/22 20:28:50

Modified files:
        src/data       : value.c value.h 

Log message:
        A few more functions for "union value"s.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/value.c?cvsroot=pspp&only_with_tag=simpler-proc&r1=1.2&r2=1.2.2.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/value.h?cvsroot=pspp&only_with_tag=simpler-proc&r1=1.7.2.1&r2=1.7.2.2

Patches:
Index: value.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/value.c,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -b -r1.2 -r1.2.2.1
--- value.c     15 Dec 2006 00:16:02 -0000      1.2
+++ value.c     22 Apr 2007 20:28:50 -0000      1.2.2.1
@@ -53,3 +53,25 @@
           ? hsh_hash_double (v->f)
           : hsh_hash_bytes (v->s, MIN (MAX_SHORT_STRING, width)));
 }
+
+/* Copies SRC to DST, given that they both contain data of the
+   given WIDTH. */
+void
+value_copy (union value *dst, const union value *src, int width) 
+{
+  if (width == 0)
+    dst->f = src->f;
+  else
+    memcpy (dst->s, src->s, width);
+}
+
+/* Sets V to the system-missing value for data of the given
+   WIDTH. */
+void
+value_set_missing (union value *v, int width) 
+{
+  if (width == 0)
+    v->f = SYSMIS;
+  else
+    memset (v->s, ' ', width); 
+}

Index: value.h
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/value.h,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -b -r1.7.2.1 -r1.7.2.2
--- value.h     19 Mar 2007 21:36:24 -0000      1.7.2.1
+++ value.h     22 Apr 2007 20:28:50 -0000      1.7.2.2
@@ -58,4 +58,7 @@
 int compare_values (const union value *, const union value *, int width);
 unsigned hash_value (const union value  *, int width);
 
+void value_copy (union value *, const union value *, int width);
+void value_set_missing (union value *, int width);
+
 #endif /* !value.h */




reply via email to

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