bindings/roojspacker
authorAlan Knowles <alan@roojs.com>
Thu, 26 May 2016 09:54:59 +0000 (17:54 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 26 May 2016 09:54:59 +0000 (17:54 +0800)
19 files changed:
bindings/roojspacker/.cvsignore [new file with mode: 0644]
bindings/roojspacker/CREDITS [new file with mode: 0644]
bindings/roojspacker/EXPERIMENTAL [new file with mode: 0644]
bindings/roojspacker/README [new file with mode: 0644]
bindings/roojspacker/manual/file-entities.ent [new file with mode: 0644]
bindings/roojspacker/manual/functions.xml [new file with mode: 0644]
bindings/roojspacker/manual/manual.xml.in [new file with mode: 0644]
bindings/roojspacker/manual/roojspacker/configure.xml [new file with mode: 0644]
bindings/roojspacker/manual/roojspacker/constants.xml [new file with mode: 0644]
bindings/roojspacker/manual/roojspacker/ini.xml [new file with mode: 0644]
bindings/roojspacker/manual/roojspacker/reference.xml [new file with mode: 0644]
bindings/roojspacker/package.xml [new file with mode: 0644]
bindings/roojspacker/package2.xml [new file with mode: 0644]
bindings/roojspacker/php_roojspacker.h [new file with mode: 0644]
bindings/roojspacker/roojspacker.c [new file with mode: 0644]
bindings/roojspacker/roojspacker.dsp [new file with mode: 0644]
bindings/roojspacker/roojspacker.xml [new file with mode: 0644]
bindings/roojspacker/tests/roojspacker__loadFile.phpt [new file with mode: 0644]
bindings/roojspacker/tests/roojspacker__pack.phpt [new file with mode: 0644]

diff --git a/bindings/roojspacker/.cvsignore b/bindings/roojspacker/.cvsignore
new file mode 100644 (file)
index 0000000..0a62640
--- /dev/null
@@ -0,0 +1,44 @@
+*.lo
+*.la
+.deps
+.libs
+Makefile
+Makefile.fragments
+Makefile.global
+Makefile.objects
+acinclude.m4
+aclocal.m4
+autom4te.cache
+build
+config.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.nice
+config.status
+config.sub
+configure
+configure.in
+conftest
+conftest.c
+include
+install-sh
+libtool
+ltmain.sh
+missing
+mkinstalldirs
+modules
+scan_makefile_in.awk
+*.dsw
+*.plg
+*.opt
+*.ncb
+Release
+Release_inline
+Debug
+Release_TS
+Release_TSDbg
+Release_TS_inline
+Debug_TS
+roojspacker*.tgz
diff --git a/bindings/roojspacker/CREDITS b/bindings/roojspacker/CREDITS
new file mode 100644 (file)
index 0000000..385bf7f
--- /dev/null
@@ -0,0 +1,2 @@
+roojspacker
+Unknown User
diff --git a/bindings/roojspacker/EXPERIMENTAL b/bindings/roojspacker/EXPERIMENTAL
new file mode 100644 (file)
index 0000000..6443e99
--- /dev/null
@@ -0,0 +1,5 @@
+this extension is experimental,
+its functions may change their names 
+or move to extension all together 
+so do not rely to much on them 
+you have been warned!
diff --git a/bindings/roojspacker/README b/bindings/roojspacker/README
new file mode 100644 (file)
index 0000000..78b8c22
--- /dev/null
@@ -0,0 +1,70 @@
+This is a standalone PHP extension created using CodeGen_PECL 1.1.3
+
+HACKING
+=======
+
+There are two ways to modify an extension created using CodeGen_PECL:
+
+1) you can modify the generated code as with any other PHP extension
+  
+2) you can add custom code to the CodeGen_PECL XML source and re-run pecl-gen
+
+The 2nd approach may look a bit complicated but you have be aware that any
+manual changes to the generated code will be lost if you ever change the
+XML specs and re-run PECL-Gen. All changes done before have to be applied
+to the newly generated code again.
+Adding code snippets to the XML source itself on the other hand may be a 
+bit more complicated but this way your custom code will always be in the
+generated code no matter how often you rerun CodeGen_PECL.
+
+
+BUILDING ON UNIX etc.
+=====================
+
+To compile your new extension, you will have to execute the following steps:
+
+1.  $ ./phpize
+2.  $ ./configure [--with-roojspacker=...] 
+3.  $ make
+4.  $ make test
+5.  $ [sudo] make install
+
+
+
+BUILDING ON WINDOWS
+===================
+
+The extension provides the VisualStudio V6 project file 
+
+  roojspacker.dsp
+To compile the extension you open this file using VisualStudio,
+select the apropriate configuration for your installation
+(either "Release_TS" or "Debug_TS") and create "php_roojspacker.dll"
+
+After successfull compilation you have to copy the newly
+created "roojspacker.dll" to the PHP
+extension directory (default: C:\PHP\extensions).
+
+
+TESTING
+=======
+
+You can now load the extension using a php.ini directive
+
+  extension="roojspacker.[so|dll]"
+
+or load it at runtime using the dl() function
+
+  dl("roojspacker.[so|dll]");
+
+The extension should now be available, you can test this
+using the extension_loaded() function:
+
+  if (extension_loaded("roojspacker"))
+    echo "roojspacker loaded :)";
+  else
+    echo "something is wrong :(";
+
+The extension will also add its own block to the output
+of phpinfo();
+
diff --git a/bindings/roojspacker/manual/file-entities.ent b/bindings/roojspacker/manual/file-entities.ent
new file mode 100644 (file)
index 0000000..a9b6870
--- /dev/null
@@ -0,0 +1,5 @@
+<!ENTITY reference.roojspacker.reference SYSTEM './roojspacker/reference.xml'>
+<!ENTITY reference.roojspacker.constants SYSTEM './roojspacker/constants.xml'>
+<!ENTITY reference.roojspacker.ini SYSTEM './roojspacker/ini.xml'>
+<!ENTITY reference.roojspacker.configure SYSTEM './roojspacker/configure.xml'>
+<!ENTITY reference.roojspacker.functions SYSTEM './functions.xml'>
diff --git a/bindings/roojspacker/manual/functions.xml b/bindings/roojspacker/manual/functions.xml
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/bindings/roojspacker/manual/manual.xml.in b/bindings/roojspacker/manual/manual.xml.in
new file mode 100644 (file)
index 0000000..45fb2e4
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.1.2//EN'
+          '@PHPDOC@/dtds/dbxml-4.1.2/docbookx.dtd' [
+
+<!-- Add translated specific definitions and snippets -->
+<!ENTITY % language-defs     SYSTEM '@PHPDOC@/en/language-defs.ent'>
+<!ENTITY % language-snippets SYSTEM '@PHPDOC@/en/language-snippets.ent'>
+
+%language-defs;
+%language-snippets;
+
+<!-- Fallback to English definitions and snippets (in case of missing translation) -->
+<!ENTITY % language-defs.default     SYSTEM '@PHPDOC@/en/language-defs.ent'>
+<!ENTITY % language-snippets.default SYSTEM '@PHPDOC@/en/language-snippets.ent'>
+<!ENTITY % extensions.default        SYSTEM '@PHPDOC@/en/extensions.ent'>
+
+%language-defs.default;
+%language-snippets.default;
+%extensions.default;
+
+<!-- All global entities for the XML files -->
+<!ENTITY % global.entities  SYSTEM '@PHPDOC@/entities/global.ent'>
+
+<!ENTITY % file.entities      SYSTEM './file-entities.ent'>
+
+<!-- Include all external DTD parts defined previously -->
+%global.entities;
+%file.entities;
+
+<!-- Autogenerated missing entites and IDs to make build work -->
+<!ENTITY % missing-entities  SYSTEM '@PHPDOC@/entities/missing-entities.ent'>
+%missing-entities;
+]>
+
+<book id='manual' lang='en'>
+   &reference.roojspacker.reference;
+</book>
diff --git a/bindings/roojspacker/manual/roojspacker/configure.xml b/bindings/roojspacker/manual/roojspacker/configure.xml
new file mode 100644 (file)
index 0000000..72c6751
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding='iso-8859-1'?>
+<!-- $Revision: 1.1 $ -->
+
+   <section id='roojspacker.requirements'>
+    &reftitle.required;
+    &no.requirement;
+
+   </section>
+
+
+   <section id='roojspacker.install'>
+    &reftitle.install;
+    <para>Requires <literal>roojspacker</literal></para>
+
+   </section>
+
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/bindings/roojspacker/manual/roojspacker/constants.xml b/bindings/roojspacker/manual/roojspacker/constants.xml
new file mode 100644 (file)
index 0000000..48eb907
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version='1.0' encoding='iso-8859-1'?>
+<!-- $Revision: 1.1 $ -->
+<section id='roojspacker.constants' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'>
+ &reftitle.constants;
+ &extension.constants;
+ <para>
+    &no.constants;
+ </para>
+</section>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/bindings/roojspacker/manual/roojspacker/ini.xml b/bindings/roojspacker/manual/roojspacker/ini.xml
new file mode 100644 (file)
index 0000000..2aa15e4
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version='1.0' encoding='iso-8859-1'?>
+<!-- $Revision: 1.1 $ -->
+<section id='roojspacker.configuration' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'>
+ &reftitle.runtime;
+ &extension.runtime;
+ <para>
+    &no.config;
+ </para>
+</section>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/bindings/roojspacker/manual/roojspacker/reference.xml b/bindings/roojspacker/manual/roojspacker/reference.xml
new file mode 100644 (file)
index 0000000..63cf575
--- /dev/null
@@ -0,0 +1,60 @@
+<?xml version='1.0' encoding='iso-8859-1'?>
+<!-- $Revision: 1.1 $ -->
+<!-- Purpose: utilspec -->
+<!-- Membership: pecl, external -->
+<!-- State: experimental -->
+
+ <reference xml:id='ref.roojspacker' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'>
+  <title>The unknown extension</title>
+  <titleabbrev>roojspacker</titleabbrev>
+
+  <partintro>
+   <section id='roojspacker.intro'>
+    &reftitle.intro;
+    <para>
+none
+    </para>
+   </section>
+   
+   <section xml:id='roojspacker.requirements'>
+    &reftitle.required;
+    <para>
+     
+    </para>
+   </section>
+
+   &reference.roojspacker.configure;
+   &reference.extname.ini;
+
+   <section id='roojspacker.resources'>
+    &reftitle.resources;
+   &no.resource;
+   </section>
+
+   &reference.extname.constants;
+  </partintro>
+
+&reference.roojspacker.functions;
+
+ </reference>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+indent-tabs-mode:nil
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/bindings/roojspacker/package.xml b/bindings/roojspacker/package.xml
new file mode 100644 (file)
index 0000000..acd4d4d
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0">
+<package>
+
+  <name>roojspacker</name>
+  <summary>The unknown extension</summary>
+  <description>
+none
+  </description>
+
+  <configureoptions>
+   <configureoption name="with-roojspacker" default="autodetect" prompt="roojspacker installation directory?" />
+  </configureoptions>
+
+  <maintainers>
+    <maintainer>
+      <user>unknown</user>
+      <name>Unknown User</name>
+      <email>unknown@example.com</email>
+      <role>lead</role>
+    </maintainer>
+  </maintainers>
+
+  <release>
+    <version>0.0.1dev</version>
+    <state>devel</state>
+    <notes>unknown</notes>
+    <date>2016-05-26</date>
+  </release>
+  <changelog>
+
+  </changelog>
+  <deps>
+    <dep type="php" rel="ge" version="5.0.0"/>
+  </deps>
+
+  <filelist>
+    <dir name="/">
+      <file role='doc' name='EXPERIMENTAL'/>
+      <file role='doc' name='CREDITS'/>
+      <file role='src' name='config.m4'/>
+      <file role='src' name='roojspacker.dsp'/>
+      <file role='src' name='config.w32'/>
+      <file role='src' name='roojspacker.c'/>
+      <file role='src' name='php_roojspacker.h'/>
+      <dir name="tests">
+        <file role='test' name='roojspacker__loadFile.phpt'/>
+        <file role='test' name='roojspacker__pack.phpt'/>
+      </dir>
+    </dir>
+  </filelist>
+</package>
diff --git a/bindings/roojspacker/package2.xml b/bindings/roojspacker/package2.xml
new file mode 100644 (file)
index 0000000..23191aa
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
+    xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+
+  <name>roojspacker</name>
+  <channel>pecl.php.net</channel>
+
+  <summary>The unknown extension</summary>
+
+  <description>
+none
+  </description>
+
+  <lead>
+    <name>Unknown User</name>
+    <user>unknown</user>
+    <email>unknown@example.com</email>
+    <active>yes</active>
+  </lead>
+
+  <date>2016-05-26</date>
+  <version>
+    <release>0.0.1dev</release>
+    <api>0.0.1dev</api>
+  </version>
+  <stability>
+    <release>devel</release>
+    <api>devel</api>
+  </stability>
+
+  <license>unknown</license>
+
+  <notes>
+none
+  </notes>
+
+  <contents>
+    <dir name="/">
+      <file role='doc' name='EXPERIMENTAL'/>
+      <file role='doc' name='CREDITS'/>
+      <file role='src' name='config.m4'/>
+      <file role='src' name='roojspacker.dsp'/>
+      <file role='src' name='config.w32'/>
+      <file role='src' name='roojspacker.c'/>
+      <file role='src' name='php_roojspacker.h'/>
+      <dir name="tests">
+        <file role='test' name='roojspacker__loadFile.phpt'/>
+        <file role='test' name='roojspacker__pack.phpt'/>
+      </dir>
+    </dir>
+  </contents>
+
+  <dependencies>
+    <required>
+      <php>
+        <min>5.0.0</min>
+      </php>
+      <pearinstaller>
+        <min>1.4.0a1</min>
+      </pearinstaller>
+    </required>
+  </dependencies>
+
+  <providesextension>roojspacker</providesextension>
+
+  <extsrcrelease>
+   <configureoption name="with-roojspacker" default="autodetect" prompt="roojspacker installation directory?" />
+  </extsrcrelease>
+
+</package>
diff --git a/bindings/roojspacker/php_roojspacker.h b/bindings/roojspacker/php_roojspacker.h
new file mode 100644 (file)
index 0000000..6acea9c
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+   +----------------------------------------------------------------------+
+   | unknown license:                                                      |
+   +----------------------------------------------------------------------+
+   | Authors: Unknown User <unknown@example.com>                          |
+   +----------------------------------------------------------------------+
+*/
+
+/* $ Id: $ */ 
+
+#ifndef PHP_ROOJSPACKER_H
+#define PHP_ROOJSPACKER_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <php.h>
+
+#ifdef HAVE_ROOJSPACKER
+#define PHP_ROOJSPACKER_VERSION "0.0.1dev"
+
+
+#include <php_ini.h>
+#include <SAPI.h>
+#include <ext/standard/info.h>
+#include <Zend/zend_extensions.h>
+#ifdef  __cplusplus
+} // extern "C" 
+#endif
+#include <roojspacker/roojspacker-1.0.h>
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+extern zend_module_entry roojspacker_module_entry;
+#define phpext_roojspacker_ptr &roojspacker_module_entry
+
+#ifdef PHP_WIN32
+#define PHP_ROOJSPACKER_API __declspec(dllexport)
+#else
+#define PHP_ROOJSPACKER_API
+#endif
+
+PHP_MINIT_FUNCTION(roojspacker);
+PHP_MSHUTDOWN_FUNCTION(roojspacker);
+PHP_RINIT_FUNCTION(roojspacker);
+PHP_RSHUTDOWN_FUNCTION(roojspacker);
+PHP_MINFO_FUNCTION(roojspacker);
+
+#ifdef ZTS
+#include "TSRM.h"
+#endif
+
+#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource))
+
+#define PROP_GET_LONG(name)    Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC)
+
+#define PROP_GET_DOUBLE(name)    Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC)
+
+#define PROP_GET_STRING(name)    Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_GET_STRLEN(name)    Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC))
+#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC)
+#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC)
+
+
+
+typedef struct _php_obj_roojspacker {
+    zend_object obj;
+    JSDOCPacker *data;
+} php_obj_roojspacker; 
+PHP_METHOD(roojspacker, loadFile);
+#if (PHP_MAJOR_VERSION >= 5)
+ZEND_BEGIN_ARG_INFO_EX(roojspacker__loadFile_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1)
+  ZEND_ARG_INFO(0, file)
+ZEND_END_ARG_INFO()
+#else /* PHP 4.x */
+#define roojspacker__loadFile_args NULL
+#endif
+
+PHP_METHOD(roojspacker, pack);
+#if (PHP_MAJOR_VERSION >= 5)
+ZEND_BEGIN_ARG_INFO_EX(roojspacker__pack_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2)
+  ZEND_ARG_INFO(0, target)
+  ZEND_ARG_INFO(0, debug_target)
+ZEND_END_ARG_INFO()
+#else /* PHP 4.x */
+#define roojspacker__pack_args NULL
+#endif
+
+#ifdef  __cplusplus
+} // extern "C" 
+#endif
+
+#endif /* PHP_HAVE_ROOJSPACKER */
+
+#endif /* PHP_ROOJSPACKER_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/bindings/roojspacker/roojspacker.c b/bindings/roojspacker/roojspacker.c
new file mode 100644 (file)
index 0000000..c75f557
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+   +----------------------------------------------------------------------+
+   | unknown license:                                                      |
+   +----------------------------------------------------------------------+
+   | Authors: Unknown User <unknown@example.com>                          |
+   +----------------------------------------------------------------------+
+*/
+
+/* $ Id: $ */ 
+
+#include "php_roojspacker.h"
+
+#if HAVE_ROOJSPACKER
+
+/* {{{ Class definitions */
+
+/* {{{ Class roojspacker */
+
+static zend_class_entry * roojspacker_ce_ptr = NULL;
+
+/* {{{ Methods */
+
+
+/* {{{ proto void loadFile(string file)
+   */
+PHP_METHOD(roojspacker, loadFile)
+{
+       zend_class_entry * _this_ce;
+       php_obj_roojspacker *payload;
+
+       zval * _this_zval = NULL;
+       const char * file = NULL;
+       int file_len = 0;
+
+
+
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &_this_zval, roojspacker_ce_ptr, &file, &file_len) == FAILURE) {
+               return;
+       }
+
+       _this_ce = Z_OBJCE_P(_this_zval);
+
+       payload = (php_obj_roojspacker *) zend_object_store_get_object(_this_zval TSRMLS_CC);
+
+       do {
+               jsdoc_packer_loadFile(payload->data , file);
+       } while (0);
+}
+/* }}} loadFile */
+
+
+
+/* {{{ proto string pack(string target, string debug_target)
+   */
+PHP_METHOD(roojspacker, pack)
+{
+       zend_class_entry * _this_ce;
+       php_obj_roojspacker *payload;
+
+       zval * _this_zval = NULL;
+       const char * target = NULL;
+       int target_len = 0;
+       const char * debug_target = NULL;
+       int debug_target_len = 0;
+
+
+
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss", &_this_zval, roojspacker_ce_ptr, &target, &target_len, &debug_target, &debug_target_len) == FAILURE) {
+               return;
+       }
+
+       _this_ce = Z_OBJCE_P(_this_zval);
+
+       payload = (php_obj_roojspacker *) zend_object_store_get_object(_this_zval TSRMLS_CC);
+
+       do {
+               gchar *buf = jsdoc_packer_pack(payload->data, target, debug_target);
+               RETURN_STRING(buf, 1);
+       } while (0);
+}
+/* }}} pack */
+
+
+static zend_function_entry roojspacker_methods[] = {
+       PHP_ME(roojspacker, loadFile, roojspacker__loadFile_args, /**/ZEND_ACC_PUBLIC)
+       PHP_ME(roojspacker, pack, roojspacker__pack_args, /**/ZEND_ACC_PUBLIC)
+       { NULL, NULL, NULL }
+};
+
+/* }}} Methods */
+
+
+static zend_object_handlers roojspacker_obj_handlers;
+
+static void roojspacker_obj_free(void *object TSRMLS_DC)
+{
+       php_obj_roojspacker *payload = (php_obj_roojspacker *)object;
+       
+       JSDOCPacker *data = payload->data;
+       do {
+               if (payload->data) g_object_unref(payload->data);
+       } while (0);
+
+       efree(object);
+}
+
+static zend_object_value roojspacker_obj_create(zend_class_entry *class_type TSRMLS_DC)
+{
+       php_obj_roojspacker *payload;
+       zval         *tmp;
+       zend_object_value retval;
+
+       payload = (php_obj_roojspacker *)emalloc(sizeof(php_obj_roojspacker));
+       memset(payload, 0, sizeof(php_obj_roojspacker));
+       payload->obj.ce = class_type;
+       do {
+               payload->data = jsdoc_packer_new();
+       } while (0);
+
+       retval.handle = zend_objects_store_put(payload, NULL, (zend_objects_free_object_storage_t) roojspacker_obj_free, NULL TSRMLS_CC);
+       retval.handlers = &roojspacker_obj_handlers;
+       
+       return retval;
+}
+
+static void class_init_roojspacker(void)
+{
+       zend_class_entry ce;
+
+       INIT_CLASS_ENTRY(ce, "roojspacker", roojspacker_methods);
+       ce.create_object = roojspacker_obj_create;
+       roojspacker_ce_ptr = zend_register_internal_class(&ce);
+       memcpy(&roojspacker_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+       roojspacker_obj_handlers.clone_obj = NULL;
+}
+
+/* }}} Class roojspacker */
+
+/* }}} Class definitions*/
+
+/* {{{ roojspacker_functions[] */
+function_entry roojspacker_functions[] = {
+       { NULL, NULL, NULL }
+};
+/* }}} */
+
+
+/* {{{ roojspacker_module_entry
+ */
+zend_module_entry roojspacker_module_entry = {
+       STANDARD_MODULE_HEADER,
+       "roojspacker",
+       roojspacker_functions,
+       PHP_MINIT(roojspacker),     /* Replace with NULL if there is nothing to do at php startup   */ 
+       PHP_MSHUTDOWN(roojspacker), /* Replace with NULL if there is nothing to do at php shutdown  */
+       PHP_RINIT(roojspacker),     /* Replace with NULL if there is nothing to do at request start */
+       PHP_RSHUTDOWN(roojspacker), /* Replace with NULL if there is nothing to do at request end   */
+       PHP_MINFO(roojspacker),
+       PHP_ROOJSPACKER_VERSION, 
+       STANDARD_MODULE_PROPERTIES
+};
+/* }}} */
+
+#ifdef COMPILE_DL_ROOJSPACKER
+ZEND_GET_MODULE(roojspacker)
+#endif
+
+
+/* {{{ PHP_MINIT_FUNCTION */
+PHP_MINIT_FUNCTION(roojspacker)
+{
+       class_init_roojspacker();
+
+       /* add your stuff here */
+
+       return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
+PHP_MSHUTDOWN_FUNCTION(roojspacker)
+{
+
+       /* add your stuff here */
+
+       return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_RINIT_FUNCTION */
+PHP_RINIT_FUNCTION(roojspacker)
+{
+       /* add your stuff here */
+
+       return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_RSHUTDOWN_FUNCTION */
+PHP_RSHUTDOWN_FUNCTION(roojspacker)
+{
+       /* add your stuff here */
+
+       return SUCCESS;
+}
+/* }}} */
+
+
+/* {{{ PHP_MINFO_FUNCTION */
+PHP_MINFO_FUNCTION(roojspacker)
+{
+       php_printf("The unknown extension\n");
+       php_info_print_table_start();
+       php_info_print_table_row(2, "Version",PHP_ROOJSPACKER_VERSION " (devel)");
+       php_info_print_table_row(2, "Released", "2016-05-26");
+       php_info_print_table_row(2, "CVS Revision", "$Id: $");
+       php_info_print_table_row(2, "Authors", "Unknown User 'unknown@example.com' (lead)\n");
+       php_info_print_table_end();
+       /* add your stuff here */
+
+}
+/* }}} */
+
+#endif /* HAVE_ROOJSPACKER */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
diff --git a/bindings/roojspacker/roojspacker.dsp b/bindings/roojspacker/roojspacker.dsp
new file mode 100644 (file)
index 0000000..c04a178
--- /dev/null
@@ -0,0 +1,112 @@
+# Microsoft Developer Studio Project File - Name="roojspacker" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=roojspacker - Win32 Debug_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "roojspacker.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "roojspacker.mak" CFG="roojspacker - Win32 Debug_TS"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "roojspacker - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "roojspacker - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "roojspacker - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_TS"
+# PROP Intermediate_Dir "Release_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ROOJSPACKER_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_ROOJSPACKER" /D ZTS=1 /D HAVE_ROOJSPACKER=1  /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS\php_roojspacker.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
+
+!ELSEIF  "$(CFG)" == "roojspacker - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_TS"
+# PROP Intermediate_Dir "Debug_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ROOJSPACKER_EXPORTS" /YX /FD /GZ  /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_ROOJSPACKER" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ROOJSPACKER=1  /YX /FD /GZ  /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS\php_roojspacker.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "roojspacker - Win32 Release_TS"
+# Name "roojspacker - Win32 Debug_TS"
+
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+
+# Begin Source File
+
+SOURCE=./roojspacker.c
+# End Source File
+
+# End Group
+
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+
+# Begin Source File
+
+SOURCE=.\php_roojspacker.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/bindings/roojspacker/roojspacker.xml b/bindings/roojspacker/roojspacker.xml
new file mode 100644 (file)
index 0000000..eb167a7
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!DOCTYPE extension SYSTEM "../extension.dtd">
+<extension name="roojspacker" version="1.0.0">
+
+ <deps>
+  <with name="roojspacker" mode="pkg-config">
+   <header name="roojspacker/roojspacker-1.0.h"/>
+  </with>
+ </deps>
+
+ <class name="roojspacker">
+  <payload type="JSDOCPacker" alloc="no"/>
+
+  <init>
+    payload->data = jsdoc_packer_new();
+  </init>
+
+  <destruct>
+        if (payload->data) g_object_unref(payload->data);
+  </destruct>
+
+
+  <function name="loadFile">
+   <proto>void loadFile(string file)</proto>
+   <code>
+    jsdoc_packer_loadFile(payload->data , file);
+    
+   </code>
+  </function>
+
+  <function name="pack">
+   <proto>string pack(string target, string debug_target)</proto>
+   <code>
+gchar *buf = jsdoc_packer_pack(payload->data, target, debug_target);
+RETURN_STRING(buf, 1);
+
+   </code>
+  </function>
+ </class>
+
+
+</extension>
\ No newline at end of file
diff --git a/bindings/roojspacker/tests/roojspacker__loadFile.phpt b/bindings/roojspacker/tests/roojspacker__loadFile.phpt
new file mode 100644 (file)
index 0000000..657d892
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+roojspacker::loadFile() member function
+--SKIPIF--
+<?php 
+
+if(!extension_loaded('roojspacker')) die('skip ');
+
+ ?>
+--FILE--
+<?php
+echo 'OK'; // no test case for this function yet
+?>
+--EXPECT--
+OK
\ No newline at end of file
diff --git a/bindings/roojspacker/tests/roojspacker__pack.phpt b/bindings/roojspacker/tests/roojspacker__pack.phpt
new file mode 100644 (file)
index 0000000..e2cbe24
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+roojspacker::pack() member function
+--SKIPIF--
+<?php 
+
+if(!extension_loaded('roojspacker')) die('skip ');
+
+ ?>
+--FILE--
+<?php
+echo 'OK'; // no test case for this function yet
+?>
+--EXPECT--
+OK
\ No newline at end of file