Skip to content

Commit

Permalink
Initial commit of version 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Schwarze authored and Benjamin Schwarze committed Jun 1, 2017
1 parent a6314a5 commit 64ecf7e
Show file tree
Hide file tree
Showing 14 changed files with 5,583 additions and 0 deletions.
44 changes: 44 additions & 0 deletions build/build_one_src_file.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

function addSrc($Name, $Target) {
echo "Adding " . basename($Name) . PHP_EOL;
fputs($Target, PHP_EOL);
$File = fopen($Name, "r");
try {
while (! feof($File)) {
fwrite($Target, fread($File, 102400));
}
}
finally {
fclose($File);
}
}

$SrcDir = realpath(dirname(__FILE__) . "/../src");
$DistDir = realpath(dirname(__FILE__) . "/../dist/one_src_file");
$TargetFile = "$DistDir/phosphor7.php";



$Target = fopen($TargetFile, "w");
try {
fputs($Target,'<?php define("PHOSPHOR7_EXTERNAL_REQUIRE_MANAGEMENT", 1); ?>');

addSrc("$SrcDir/p7_global.php", $Target);
addSrc("$SrcDir/p7_ctypes.php", $Target);
addSrc("$SrcDir/p7_errno.php", $Target);
addSrc("$SrcDir/p7_netinet_in.php", $Target);
addSrc("$SrcDir/snap_sysutils.php", $Target);
addSrc("$SrcDir/snap_msgsock.php", $Target);
addSrc("$SrcDir/s7_isotcp.php", $Target);
addSrc("$SrcDir/s7_types.php", $Target);
addSrc("$SrcDir/s7_peer.php", $Target);
addSrc("$SrcDir/s7_micro_client.php", $Target);
addSrc("$SrcDir/phosphor7.php", $Target);
}
finally {
fclose($Target);
echo "Done!" . PHP_EOL;
}

?>
2 changes: 2 additions & 0 deletions dist/one_src_file/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
15 changes: 15 additions & 0 deletions examples/read_db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

require_once("../src/phosphor7.php");

$c = new TSnap7MicroClient();

$c->ConnectTo("10.11.6.2", 0, 0);

$buffer = "";
$c->DBRead(7, 0, 12, $buffer); //reads first 12 bytes of DB07
var_dump(bin2hex($buffer));

$c->Disconnect();

?>
Loading

0 comments on commit 64ecf7e

Please sign in to comment.