updated inline docs

This commit is contained in:
seek3r 2001-12-23 10:15:40 +00:00
parent 6f63d49bd0
commit 7e57e1197a
2 changed files with 153 additions and 38 deletions

View File

@ -12,8 +12,82 @@
/* $Id$ */ /* $Id$ */
$types = array('abstract','param','example','syntax','result','description','discussion','author','copyright','package','access'); include ('../phpgwapi/inc/class.Template.inc.php');
function parseobject($input)
{
$types = array('abstract','param','example','syntax','result','description','discussion','author','copyright','package','access');
$new = explode("@",$input);
while (list($x,$y) = each($new))
{
if (!isset($object) || trim($new[0]) == $object)
{
$t = trim($new[0]);
$t = trim(ereg_replace('#'.'function'.' ','',$t));
reset($types);
while(list($z,$type) = each($types))
{
if(ereg('#'.$type.' ',$y))
{
$xkey = $type;
$out = $y;
$out = trim(ereg_replace('#'.$type.' ','',$out));
break;
}
else
{
$xkey = 'unknown';
$out = $y;
}
}
if($out != $new[0])
{
$output[$t][$xkey][] = $out;
}
}
}
return Array('name' => $t, 'value' => $output[$t]);
}
function parsesimpleobject($input)
{
$types = array('abstract','param','example','syntax','result','description','discussion','author','copyright','package','access');
$input = ereg_replace ("@", "@#", $input);
$new = explode("@",$input);
unset ($new[0], $new[1]);
while (list($x,$y) = each($new))
{
if (!isset($object) || trim($new[0]) == $object)
{
$t = trim($new[0]);
reset($types);
while(list($z,$type) = each($types))
{
if(ereg('#'.$type.' ',$y))
{
$xkey = $type;
$out = $y;
$out = trim(ereg_replace('#'.$type.' ','',$out));
break;
}
else
{
$xkey = 'unknown';
$out = $y;
}
}
if($out != $new[0])
{
$output[$t][$xkey][] = $out;
}
}
}
return Array('name' => $t, 'value' => $output[$t]);
}
$app = $GLOBALS['HTTP_GET_VARS']['app']; $app = $GLOBALS['HTTP_GET_VARS']['app'];
$fn = $GLOBALS['HTTP_GET_VARS']['fn']; $fn = $GLOBALS['HTTP_GET_VARS']['fn'];
@ -59,8 +133,9 @@
while (list($p,$fn) = each($files)) while (list($p,$fn) = each($files))
{ {
$matches = $elements = $data = array(); $matches = $elements = $data = $class = array();
$string = $t = $out = $class = $xkey = $new = ''; $string = $t = $out = $xkey = $new = '';
//$string = $t = $out = $class = $xkey = $new = '';
$file = '../'.$app.'/inc/' . $fn; $file = '../'.$app.'/inc/' . $fn;
echo '<br>Looking at: ' . $file . "\n"; echo '<br>Looking at: ' . $file . "\n";
@ -73,48 +148,80 @@
preg_match_all("#\*\!(.*)\*/#sUi",$string,$matches,PREG_SET_ORDER); preg_match_all("#\*\!(.*)\*/#sUi",$string,$matches,PREG_SET_ORDER);
/* Now that I have the list of found inline docs, I need to figure out which group they belong to. */
$idx = 0;
$ssmatches = $matches;
reset($ssmatches);
while (list($sskey,$ssval) = each($ssmatches))
{
if (preg_match ("/@class_start/i", $ssval[1]))
{
$ssval[1] = ereg_replace ("@", "@#", $ssval[1]);
$ssval[1] = explode("@",$ssval[1]);
$ssresult = trim(ereg_replace ("#class_start", "", $ssval[1][1]));
$sstype = 'class';
unset($matches[$idx][1][0], $matches[$idx][1][1]);
$matches_starts[$sstype.' '.$ssresult] = $matches[$idx][1];
unset($matches[$idx]);
}
elseif (preg_match ("/@class_end $ssresult/i", $ssval[1]))
{
unset($ssresult);
unset($matches[$idx]);
}
elseif (preg_match ("/@collection_start/i", $ssval[1]))
{
$ssval[1] = ereg_replace ("@", "@#", $ssval[1]);
$ssval[1] = explode("@",$ssval[1]);
$ssresult = trim(ereg_replace ("#collection_start", "", $ssval[1][1]));
$sstype = 'collection';
unset($matches[$idx][1][0], $matches[$idx][1][1]);
$matches_starts[$sstype.' '.$ssresult] = $matches[$idx][1];
unset($matches[$idx]);
}
elseif (preg_match ("/@collection_end $ssresult/i", $ssval[1]))
{
unset($ssresult);
unset($matches[$idx]);
}
else
{
if (isset($ssresult))
{
$startstop[$idx] = $sstype.' '.$ssresult;
}
else
{
$startstop[$idx] = 'some_lame_string_that_wont_be_used_by_a_function';
}
}
$idx = $idx + 1;
}
unset($ssmatches, $sskey, $ssval, $ssresult, $sstype, $idx);
reset($startstop);
while (list($key,$val) = each($matches)) while (list($key,$val) = each($matches))
{ {
preg_match_all("#@(.*)$#sUi",$val[1],$data); preg_match_all("#@(.*)$#sUi",$val[1],$data);
$new = explode("@",$data[1][0]); $data[1][0] = ereg_replace ("@", "@#", $data[1][0]);
while (list($x,$y) = each($new)) $returndata = parseobject($data[1][0]);
if ($startstop[$key] == 'some_lame_string_that_wont_be_used_by_a_function')
{ {
if (!isset($object) || trim($new[0]) == $object) $class[$returndata['name']] = $returndata['value'];
//if (trim($new[0]) == $object) }
else
{
if (isset($matches_starts[$startstop[$key]]))
{ {
$t = trim($new[0]); $returndoc = parsesimpleobject($matches_starts[$startstop[$key]]);
if(!$key) $class[$startstop[$key]][0] = $returndoc['value'];
{ //$class[$startstop[$key]][0] = $matches_starts[$startstop[$key]];
$class = $t;
}
$t = trim(ereg_replace('function','',$t));
reset($types);
while(list($z,$type) = each($types))
{
if(ereg($type,$y))
{
$xkey = $type;
$out = $y;
$out = ereg_replace($type,'',$out);
break;
}
else
{
$xkey = 'unknown';
$out = $y;
}
}
if($out != $new[0])
{
$elements[$class][$t][$xkey][] = $out;
}
} }
$class[$startstop[$key]][$returndata['name']] = $returndata['value'];
} }
} }
echo '<br><pre>'; echo '<br><pre>';
print_r($elements); print_r($class);
// var_dump($elements); // var_dump($elements);
echo '</pre>' . "\n"; echo '</pre>' . "\n";
} }

View File

@ -39,6 +39,10 @@
* Direct functions, which are not part of the API class * * Direct functions, which are not part of the API class *
* because they are require to be availble at the lowest level. * * because they are require to be availble at the lowest level. *
\****************************************************************************/ \****************************************************************************/
/*!
@collection_start direct functions
@abstract Direct functions, which are not part of the API class because they are require to be availble at the lowest level.
*/
/*! /*!
@function sanitize @function sanitize
@ -405,7 +409,7 @@
} }
/*! /*!
@function get_account_id() @function get_account_id
@abstract Return a properly formatted account_id. @abstract Return a properly formatted account_id.
@author skeeter @author skeeter
@discussion This function will return a properly formatted account_id. This can take either a name or an account_id as paramters. If a name is provided it will return the associated id. @discussion This function will return a properly formatted account_id. This can take either a name or an account_id as paramters. If a name is provided it will return the associated id.
@ -446,7 +450,7 @@
} }
/*! /*!
@function filesystem_separator() @function filesystem_separator
@abstract sets the file system seperator depending on OS @abstract sets the file system seperator depending on OS
@result file system separator @result file system separator
*/ */
@ -488,6 +492,10 @@
} }
} }
/*!
@collection_end direct functions
*/
// print_debug('core functions are done'); // print_debug('core functions are done');
/****************************************************************************\ /****************************************************************************\
* Quick verification of sane environment * * Quick verification of sane environment *