]> gitweb.factorcode.org Git - factor.git/commitdiff
python: metadata files and a first stab at documentation
authorBjörn Lindqvist <bjourne@gmail.com>
Thu, 30 Jan 2014 20:29:21 +0000 (21:29 +0100)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 4 Mar 2014 17:23:04 +0000 (09:23 -0800)
extra/python/authors.txt [new file with mode: 0644]
extra/python/summary.txt [new file with mode: 0644]
extra/python/syntax/authors.txt [new file with mode: 0644]
extra/python/syntax/summary.txt [new file with mode: 0644]
extra/python/syntax/syntax-docs.factor [new file with mode: 0644]

diff --git a/extra/python/authors.txt b/extra/python/authors.txt
new file mode 100644 (file)
index 0000000..8c0a152
--- /dev/null
@@ -0,0 +1 @@
+Björn Lindqvist
diff --git a/extra/python/summary.txt b/extra/python/summary.txt
new file mode 100644 (file)
index 0000000..2266a5c
--- /dev/null
@@ -0,0 +1 @@
+Python interface
diff --git a/extra/python/syntax/authors.txt b/extra/python/syntax/authors.txt
new file mode 100644 (file)
index 0000000..8c0a152
--- /dev/null
@@ -0,0 +1 @@
+Björn Lindqvist
diff --git a/extra/python/syntax/summary.txt b/extra/python/syntax/summary.txt
new file mode 100644 (file)
index 0000000..af0c43e
--- /dev/null
@@ -0,0 +1 @@
+Syntax for defining Python wrappers
diff --git a/extra/python/syntax/syntax-docs.factor b/extra/python/syntax/syntax-docs.factor
new file mode 100644 (file)
index 0000000..b659853
--- /dev/null
@@ -0,0 +1,35 @@
+IN: python.syntax
+USING: python.syntax help.markup help.syntax ;
+
+HELP: PY-FROM:
+{ $syntax "PY-FROM: module => name-effects ;" }
+{ $values
+  { "module" "fully qualified name of a python module" }
+  { "name-effects" "pairs of names and effect declarations of bindings to import" }
+}
+{ $description
+  "Creates factor words that maps to the given python objects."
+}
+{ $examples
+  { $code
+    "PY-FROM: os.path => isfile ( path -- ? ) splitext ( path -- root ext ) ;"
+  }
+} ;
+
+HELP: PY-METHODS:
+{ $syntax "PY-METHODS: class => name-effects ;" }
+{ $values
+  { "class" "name of a class to associate the bindings with" }
+  { "name-effects" "pairs of names and effect declarations of methods to create" }
+}
+{ $description
+  "Creates factor words that acts as properties and getters and can work on any python object."
+}
+{ $examples
+  { $code
+    "PY-FROM: zipfile => ZipFile ( name mode -- file ) ;"
+    "PY-METHODS: ZipFile => namelist ( self -- names ) ;"
+    "! Then use the declarations like this"
+    "\"name-of-zip.zip\" >py \"r\" >py ZipFile namelist >factor"
+  }
+} ;