PHP 8.2.30
Preview: AutoGeneratedDefinitions.cpp.cxxcodebuilder Size: 4.41 KB
/opt/cpanel/ea-ruby27/src/passenger-release-6.1.2/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder

#  Phusion Passenger - https://www.phusionpassenger.com/
#  Copyright (c) 2010-2025 Asynchronous B.V.
#
#  "Passenger", "Phusion Passenger" and "Union Station" are registered
#  trademarks of Asynchronous B.V.
#
#  Permission is hereby granted, free of charge, to any person obtaining a copy
#  of this software and associated documentation files (the "Software"), to deal
#  in the Software without restriction, including without limitation the rights
#  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#  copies of the Software, and to permit persons to whom the Software is
#  furnished to do so, subject to the following conditions:
#
#  The above copyright notice and this permission notice shall be included in
#  all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#  THE SOFTWARE.

# This file uses the cxxcodebuilder API. Learn more at:
# https://github.com/phusion/cxxcodebuilder

require 'phusion_passenger/apache2/config_options'

def main
  comment copyright_header_for(__FILE__), 1

  separator

  comment %q{
    ConfigGeneral/AutoGeneratedDefinitions.cpp is automatically generated from
    ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder,
    using ConfigGeneral/AutoGenerateddefinitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
    Edits to ConfigGeneral/AutoGeneratedDefinitions.cpp will be lost.

    To update ConfigGeneral/AutoGeneratedDefinitions.cpp:
      rake apache2

    To force regeneration of ConfigGeneral/AutoGeneratedDefinitions.cpp:
      rm -f src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp
      rake src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp
  }

  separator

  add_code %Q[
    #ifdef INTELLISENSE
      // This include does nothing, but keeps IntelliSense happy.
      #include <http_config.h>
    #endif

    namespace Passenger {
    namespace Apache2Module {

    extern "C" const command_rec passenger_commands[] = {
  ]

  indent do
    APACHE2_CONFIGURATION_OPTIONS.each do |option|
      option = resolve_possible_alias(option)
      format =
        "%s(%s,\n" \
        "\t(%s) %s,\n" \
        "\tNULL,\n" \
        "\t%s,\n" \
        "\t%s),\n"
      code = sprintf(format,
        macro_for(option),
        name_for(option),
        function_type_for(option),
        function_for(option),
        definition_context_for(option),
        description_for(option))
      add_code(code)
    end
  end

  add_code %Q[
      { NULL }
    };

    } // namespace Apache2Module
    } // namespace Passenger
  ]
end

def resolve_possible_alias(option)
  if option[:alias_for]
    the_alias = APACHE2_CONFIGURATION_OPTIONS.find do |o|
      o[:name] == option[:alias_for]
    end.dup
    the_alias[:aliased_for] = option[:name]
    the_alias
  else
    option
  end
end

def macro_for(option)
  case option[:type]
  when :string, :integer, :string_array, :string_set
    "AP_INIT_TAKE1"
  when :string_keyval
    "AP_INIT_TAKE2"
  when :flag
    "AP_INIT_FLAG"
  else
    raise "Unknown type #{option[:type].inspect} for option #{option[:name].inspect}"
  end
end

def name_for(option)
  str_val(option[:aliased_for] || option[:name])
end

def function_type_for(option)
  case option[:type]
  when :string, :integer, :string_array, :string_set
    "Take1Func"
  when :string_keyval
    "Take2Func"
  when :flag
    "FlagFunc"
  else
    raise "Unknown type #{option[:type].inspect}"
  end
end

def function_for(option)
  if option[:function]
    option[:function]
  else
    function_name = option[:name].gsub(/[A-Z]/) do |letter|
      "_" + letter[0..0].downcase
    end
    "cmd#{function_name}"
  end
end

def definition_context_for(option)
  case option[:context]
  when :global
    'RSRC_CONF'
  when :application
    'RSRC_CONF | ACCESS_CONF'
  when :location
    result = ['RSRC_CONF', 'ACCESS_CONF', option[:htaccess_context]]
    result.flatten.join(' | ')
  else
    raise "Unknown context #{option[:context].inspect}"
  end
end

def description_for(option)
  option[:desc].inspect
end

main

Directory Contents

Dirs: 0 × Files: 9

Name Size Perms Modified Actions
19.82 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
4.41 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
9.35 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
5.46 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
35.30 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
6.18 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
1.63 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
22.29 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download
2.22 KB lrw-r--r-- 2026-01-27 23:50:52
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).