From f0e2972cc6c79c47d7c0560543041a7a4925f46e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Tue, 15 Oct 1996 03:17:07 +0200
Subject: [PATCH] New documenation for 'struct svalues'

Rev: doc/internal/svalue/IS_ZERO:1.1
Rev: doc/internal/svalue/assign_svalue:1.1
Rev: doc/internal/svalue/free_svalue:1.1
Rev: doc/internal/svalue/is_eq:1.1
Rev: doc/internal/svalue/is_equal:1.1
Rev: doc/internal/svalue/is_lt:1.1
Rev: doc/internal/svalue/svalue:1.1
---
 doc/internal/svalue/IS_ZERO       | 20 ++++++++++++++++++
 doc/internal/svalue/assign_svalue | 18 ++++++++++++++++
 doc/internal/svalue/free_svalue   | 18 ++++++++++++++++
 doc/internal/svalue/is_eq         | 17 ++++++++++++++++
 doc/internal/svalue/is_equal      | 18 ++++++++++++++++
 doc/internal/svalue/is_lt         | 22 ++++++++++++++++++++
 doc/internal/svalue/svalue        | 34 +++++++++++++++++++++++++++++++
 7 files changed, 147 insertions(+)
 create mode 100644 doc/internal/svalue/IS_ZERO
 create mode 100644 doc/internal/svalue/assign_svalue
 create mode 100644 doc/internal/svalue/free_svalue
 create mode 100644 doc/internal/svalue/is_eq
 create mode 100644 doc/internal/svalue/is_equal
 create mode 100644 doc/internal/svalue/is_lt
 create mode 100644 doc/internal/svalue/svalue

diff --git a/doc/internal/svalue/IS_ZERO b/doc/internal/svalue/IS_ZERO
new file mode 100644
index 0000000000..52fcfe95d6
--- /dev/null
+++ b/doc/internal/svalue/IS_ZERO
@@ -0,0 +1,20 @@
+NAME
+	IS_ZERO - is this svalue considered 'false'
+
+SYNTAX
+	#include <simulate.h>
+
+	int IS_ZERO(struct svalue *s);
+
+DESCRIPTION
+	IS_ZERO returns true if the svalue 's' is a zero. (or an object with
+	`! operator that returned true..)
+
+NOTA BENE
+	IS_ZERO is actually a macro
+
+KEYWORDS
+	svalue
+
+SEE ALSO
+	is_eq, is_equal, is_lt
\ No newline at end of file
diff --git a/doc/internal/svalue/assign_svalue b/doc/internal/svalue/assign_svalue
new file mode 100644
index 0000000000..48853e89e9
--- /dev/null
+++ b/doc/internal/svalue/assign_svalue
@@ -0,0 +1,18 @@
+NAME
+	assign_svalue - copy svalues from one place to another
+
+SYNTAX
+	#include <svalue.h>
+
+	void assign_svalue(struct svale *to, struct svalue *from);
+
+DESCRIPTION
+	This function copies an svalue from one struct svalue to another.
+	It frees the contents of 'to' first and updates the involved
+	refcounts.
+
+KEYWORDS
+	svalue
+
+SEE ALSO
+	free_svalue
\ No newline at end of file
diff --git a/doc/internal/svalue/free_svalue b/doc/internal/svalue/free_svalue
new file mode 100644
index 0000000000..eaa38804b1
--- /dev/null
+++ b/doc/internal/svalue/free_svalue
@@ -0,0 +1,18 @@
+NAME
+	free_svalue - free the contents of an svalue
+
+SYNTAX
+	#include <svalue.h>
+
+	void free_svalue(struct svalue *s);
+
+DESCRIPTION
+	This function frees the contents of an svalue with respect to
+	ref counts. It does not however free the storage for svalue itself.
+	That is up to the caller to do.
+
+KEYWORDS
+	svalue
+
+SEE ALSO
+	assign_svalue
\ No newline at end of file
diff --git a/doc/internal/svalue/is_eq b/doc/internal/svalue/is_eq
new file mode 100644
index 0000000000..31f7d11125
--- /dev/null
+++ b/doc/internal/svalue/is_eq
@@ -0,0 +1,17 @@
+NAME
+	is_eq - compare two svalues
+
+SYNTAX
+	#include <svalue.h>
+
+	int is_eq(struct svalue *a, struct svalue *b);
+
+DESCRIPTION
+	This is the equivialent of the Pike operator `==. It compares two
+	svalues and returns one if they are the same. Otherwise zero.
+
+KEYWORDS
+	svalue
+
+SEE ALSO
+	is_equal, is_lt, IS_ZERO
diff --git a/doc/internal/svalue/is_equal b/doc/internal/svalue/is_equal
new file mode 100644
index 0000000000..e838fa2e61
--- /dev/null
+++ b/doc/internal/svalue/is_equal
@@ -0,0 +1,18 @@
+NAME
+	is_equal - compare two svalues recursively
+
+SYNTAX
+	#include <svalue.h>
+
+	int is_equal(struct svalue *a, struct svalue *b);
+
+DESCRIPTION
+	This is the equivialent of the Pike function equal(), it compares
+	two svalues recursively and returns 1 if their contents are equal,
+	zero otherwise.
+
+KEYWORDS
+	svalue
+
+SEE ALSO
+	is_eq, is_lt, IS_ZERO
diff --git a/doc/internal/svalue/is_lt b/doc/internal/svalue/is_lt
new file mode 100644
index 0000000000..64bba53876
--- /dev/null
+++ b/doc/internal/svalue/is_lt
@@ -0,0 +1,22 @@
+NAME
+	is_lt - compare two svalues
+
+SYNTAX
+	#include <svalue.h>
+
+	int is_lt(struct svalue *a, struct svalue *b);
+
+DESCRIPTION
+	This is the equivialent of the Pike operator `<. It compares the
+	contents of two svalues and returns true if the 'a' is lesser than
+	'b'. It will give an error if the types are not comparable.
+
+NOTA BENE
+	is_gt, is_ge and is_le are also available. They are all macros that
+	call this function.
+
+KEYWORDS
+	svalue
+
+SEE ALSO
+	is_eq, is_equal
\ No newline at end of file
diff --git a/doc/internal/svalue/svalue b/doc/internal/svalue/svalue
new file mode 100644
index 0000000000..3d1f88f1b3
--- /dev/null
+++ b/doc/internal/svalue/svalue
@@ -0,0 +1,34 @@
+NAME
+	svalue - internal type for storing Pike values
+
+DESCRIPTION
+	The 'struct svalue' contains one Pike 'value', variables, arrays
+	and the evaluator are all svalues. An svalue consists of three
+	elements: type, subtype and a union containing the actual value.
+	The type is a short which tells you what type the svalue is. The
+	value is one of the following:
+
+	T_ARRAY  	When type is T_ARRAY, the array is stored in
+	          	the 'array' member of the union. So if sval is
+	        	the pointer to the svalue, you would use sval->u.array
+	        	to access the actual array.
+	T_MAPPING	In this case, you use sval->u.mapping.
+	T_MULTISET	sval->u.multiset
+	T_OBJECT	sval->u.object
+	T_FUNCTION	Functions are a bit more difficult, sval->u.object
+	          	is the object the function is in, and sval->subtype
+	         	is the number of the function in that object.
+	T_PROGRAM	sval->u.program is the struct program you want.
+	T_STRING	sval->u.string
+	T_FLOAT 	sval->u.float_number
+	T_INT   	sval->u.integer, a special case is that sval->subtype
+	        	is used in some cases to represent the value
+	        	'undefined'. This is what zero_type detects.
+
+	There are lots of functions operating on svalues, so you shouldn't
+	have to do all that much stuff with them yourself. However, for now
+	you do need to check the type and extract the proper member of the
+	union yourself when writing your own C functions for Pike.
+
+KEYWORDS
+	internals
-- 
GitLab