Regular expression support. Argument passing by name option. New FML
[egate.git] / fml / marc3.fml
diff --git a/fml/marc3.fml b/fml/marc3.fml
new file mode 100644 (file)
index 0000000..6bb5341
--- /dev/null
@@ -0,0 +1,72 @@
+# FML marc rutines - with passing of code and regular expressions
+#
+# $Id: marc3.fml,v 1.1 1995/02/27 09:01:21 adam Exp $
+\func case tag indicator identifier \code {
+       \if {\match \tag {\line\index 1}} {
+       \if {\match \indicator {\line\index 2}} {
+               \foreach field {\line \index 3} {
+                       \if{\match \identifier \field\index 1} {
+                               \set info {\field \index 2}
+                               \code
+                       }
+               }
+       } }
+}
+
+\func marc rec \code {
+       \foreach line {\rec} {\code}
+}
+       
+\func testfmt record {
+       \marc {\record} {
+               \case 245 00 a { 245 00 a: \info\n }
+               \case 100 00 [bc] { 100 00 [bc]: \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} } 
+        } }
+}
+}