]> granicus.if.org Git - php/commitdiff
* added emacs footer
authorStig Bakken <ssb@php.net>
Wed, 25 Jul 2001 21:20:31 +0000 (21:20 +0000)
committerStig Bakken <ssb@php.net>
Wed, 25 Jul 2001 21:20:31 +0000 (21:20 +0000)
pear/scripts/pearize.in

index 0f03d21083a4deecf725338599f9abb679b68b1e..332f3333aa43eac5594c2588a5f940ab60a72a2c 100644 (file)
@@ -7,9 +7,9 @@ main($argc, $argv, $HTTP_ENV_VARS);
 
 function main(&$argc, &$argv, &$env)
 {
-    $file = check_options($argc, $argv, $env);
-    parse_package_file($file);
-    make_makefile_in($env);
+       $file = check_options($argc, $argv, $env);
+       parse_package_file($file);
+       make_makefile_in($env);
 }
 
 // }}}
@@ -17,11 +17,11 @@ function main(&$argc, &$argv, &$env)
 
 function check_options(&$argc, &$argv, &$env)
 {
-    $file = $argv[1];
-    if (empty($file)) {
-       $file = "package.xml";
-    }
-    return $file;
+       $file = $argv[1];
+       if (empty($file)) {
+               $file = "package.xml";
+       }
+       return $file;
 }
 
 // }}}
@@ -29,38 +29,38 @@ function check_options(&$argc, &$argv, &$env)
 
 function make_makefile_in(&$env)
 {
-    global $libdata;
-    if (sizeof($libdata) == 0) {
-       exit;
-    } elseif (sizeof($libdata) > 1) {
-       die("No support yet for multiple libraries in one package.\n");
-    }
-
-    $wp = @fopen("Makefile.in", "w");
-    if (is_resource($wp)) {
-       print "Creating Makefile.in...";
-       flush();
-    } else {
-       die("Could not create Makefile.in in current directory.\n");
-    }
-
-    foreach ($libdata as $lib => $info) {
-       extract($info);
-       $_who = $env["USER"];
-       $_when = gmdate('Y-m-d h:i');
-       fwrite($wp, "\
+       global $libdata;
+       if (sizeof($libdata) == 0) {
+               exit;
+       } elseif (sizeof($libdata) > 1) {
+               die("No support yet for multiple libraries in one package.\n");
+       }
+
+       $wp = @fopen("Makefile.in", "w");
+       if (is_resource($wp)) {
+               print "Creating Makefile.in...";
+               flush();
+       } else {
+               die("Could not create Makefile.in in current directory.\n");
+       }
+
+       foreach ($libdata as $lib => $info) {
+               extract($info);
+               $_who = $env["USER"];
+               $_when = gmdate('Y-m-d h:i');
+               fwrite($wp, "\
 # This file was generated by `pearize' by $_who at $_when GMT
-INCLUDES                = $includes
-LTLIBRARY_NAME          = lib{$lib}.la
-LTLIBRARY_SOURCES       = $sources
-LTLIBRARY_SHARED_NAME   = {$lib}.la
+INCLUDES                               = $includes
+LTLIBRARY_NAME                 = lib{$lib}.la
+LTLIBRARY_SOURCES              = $sources
+LTLIBRARY_SHARED_NAME  = {$lib}.la
 LTLIBRARY_SHARED_LIBADD = $libadd
 
 include \$(top_srcdir)/build/dynlib.mk
 ");
-    }
-    fclose($wp);
-    print "done.\n";
+       }
+       fclose($wp);
+       print "done.\n";
 }
 
 // }}}
@@ -68,27 +68,27 @@ include \$(top_srcdir)/build/dynlib.mk
 
 function parse_package_file($file)
 {
-    global $in_file, $curlib, $curelem, $libdata, $cdata;
-    
-    $in_file = false;
-    $curlib = '';
-    $curelem = '';
-    $libdata = array();
-    $cdata = array();
-    
-    $xp = xml_parser_create();
-    xml_set_element_handler($xp, "start_handler", "end_handler");
-    xml_set_character_data_handler($xp, "cdata_handler");
-    xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-    
-    $fp = @fopen($file, "r");
-    if (!is_resource($fp)) {
-       die("Could not open file `$file'.\n");
-    }
-    while (!feof($fp)) {
-       xml_parse($xp, fread($fp, 2048), feof($fp));
-    }
-    xml_parser_free($xp);
+       global $in_file, $curlib, $curelem, $libdata, $cdata;
+       
+       $in_file = false;
+       $curlib = '';
+       $curelem = '';
+       $libdata = array();
+       $cdata = array();
+       
+       $xp = xml_parser_create();
+       xml_set_element_handler($xp, "start_handler", "end_handler");
+       xml_set_character_data_handler($xp, "cdata_handler");
+       xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
+       
+       $fp = @fopen($file, "r");
+       if (!is_resource($fp)) {
+               die("Could not open file `$file'.\n");
+       }
+       while (!feof($fp)) {
+               xml_parse($xp, fread($fp, 2048), feof($fp));
+       }
+       xml_parser_free($xp);
 }
 
 // }}}
@@ -96,29 +96,29 @@ function parse_package_file($file)
 
 function start_handler($xp, $elem, $attrs)
 {
-    global $cdata, $in_file, $curelem;
-    switch ($elem) {
-       case "File": {
-           switch ($attrs['Role']) {
-               case "ext": {
-                   $in_file = true;
-                   $cdata = array();
-                   break;
+       global $cdata, $in_file, $curelem;
+       switch ($elem) {
+               case "File": {
+                       switch ($attrs['Role']) {
+                               case "ext": {
+                                       $in_file = true;
+                                       $cdata = array();
+                                       break;
+                               }
+                               case "php": default: {
+                                       break;
+                               }
+                       }
+                       break;
                }
-               case "php": default: {
-                   break;
+               case "Includes":
+               case "LibName":
+               case "LibAdd":
+               case "Sources": {
+                       $curelem = $elem;
+                       break;
                }
-           }
-           break;
-       }
-       case "Includes":
-       case "LibName":
-       case "LibAdd":
-       case "Sources": {
-           $curelem = $elem;
-           break;
        }
-    }
 }
 
 // }}}
@@ -126,21 +126,21 @@ function start_handler($xp, $elem, $attrs)
 
 function end_handler($xp, $elem)
 {
-    global $in_file, $curlib, $curelem, $libdata, $cdata;
-    switch ($elem) {
-       case "File": {
-           if ($in_file === true) {
-               $libname = trim($cdata['LibName']);
-               $libdata[$libname] = array(
-                   "sources" => trim($cdata['Sources']),
-                   "includes" => trim($cdata['Includes']),
-                   "libadd" => trim($cdata['LibAdd']),
-               );
-               $in_file = false;
-           }
-           break;
+       global $in_file, $curlib, $curelem, $libdata, $cdata;
+       switch ($elem) {
+               case "File": {
+                       if ($in_file === true) {
+                               $libname = trim($cdata['LibName']);
+                               $libdata[$libname] = array(
+                                       "sources" => trim($cdata['Sources']),
+                                       "includes" => trim($cdata['Includes']),
+                                       "libadd" => trim($cdata['LibAdd']),
+                               );
+                               $in_file = false;
+                       }
+                       break;
+               }
        }
-    }
 }
 
 // }}}
@@ -148,18 +148,25 @@ function end_handler($xp, $elem)
 
 function cdata_handler($xp, $data)
 {
-    global $curelem, $cdata;
-    switch ($curelem) {
-       case "Includes":
-       case "LibAdd":
-       case "LibName":
-       case "Sources": {
-           $cdata[$curelem] .= $data;
-           break;
+       global $curelem, $cdata;
+       switch ($curelem) {
+               case "Includes":
+               case "LibAdd":
+               case "LibName":
+               case "Sources": {
+                       $cdata[$curelem] .= $data;
+                       break;
+               }
        }
-    }
 }
 
 // }}}
 
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
 ?>