Regular expression support. Argument passing by name option. New FML
[egate.git] / fml / marc2.fml
diff --git a/fml/marc2.fml b/fml/marc2.fml
new file mode 100644 (file)
index 0000000..5e9d78d
--- /dev/null
@@ -0,0 +1,73 @@
+# FML marc rutines - with passing of code.
+#
+# $Id: marc2.fml,v 1.1 1995/02/27 09:01:21 adam Exp $
+\func case tag indicator identifier \code {
+       \if {{\strcmp \tag \line\index 1}\eq 0} {
+       \if {{\strcmp \indicator \line\index 2}\eq 0} {
+               \foreach field {\line \index 3} {
+                       \if{{\strcmp \identifier \field\index 1}\eq 0}
+                       {
+                               \set info {\field \index 2}
+                               \code
+                       }
+               }
+       } }
+}
+
+\func marc rec \code {
+       \foreach line {\rec} {\code}
+}
+       
+\func testfmt record {
+       \marc {\record} {
+               \case 245 00 a { 24500a: \info\n }
+               \case 100 00 b { 10000b: \info\n }
+               \case 101 00 x { }
+               \case 102 00 x { }
+               \case 103 00 x { }
+               \case 104 00 x { }
+               \case 105 00 x { }
+               \case 106 00 x { }
+       }
+}
+
+\foreach i {1 2 3 4 5 6 7 8 9 10}
+{
+\testfmt \list {     
+       { 008 00 {
+                { b {a b c d e f} } 
+                { c {a b c d e f} } 
+        } }
+       { 100 00 {
+                { b {Felt 100-b} } 
+                { c {felt 100-c} } 
+        } }
+       { 245 00 {
+                { a {Felt 245-x} } 
+        } }
+       { 260 00 {
+                { b {Felt 100-b} } 
+                { c {felt 100-c} } 
+        } }
+       { 970 00 {
+                { b {Felt 100-b} } 
+                { c {felt 100-c} } 
+        } }
+       { 971 00 {
+                { b {Felt 100-b} } 
+                { c {felt 100-c} } 
+        } }
+       { 972 00 {
+                { b {Felt 100-b} } 
+                { c {felt 100-c} } 
+        } }
+       { 973 00 {
+                { b {Felt 100-b} } 
+                { c {felt 100-c} } 
+        } }
+       { 974 00 {
+                { b {Felt 100-b} } 
+                { c {felt 100-c} } 
+        } }
+}
+}