in scripts/extract_headers.rb [54:100]
def generate_defs!
@target_struct = nil
@open_comment = false
@all_known_enums = []
@enum_defs = {}
@struct_defs = {}
@typedefs = []
['nodes/parsenodes', 'nodes/primnodes', 'nodes/lockoptions',
'nodes/nodes', 'nodes/params', 'access/attnum', 'c', 'postgres', 'postgres_ext',
'storage/block', 'access/sdir'].each do |group|
@target_group = group
@struct_defs[@target_group] = {}
@enum_defs[@target_group] = {}
@comment_text = nil
lines = File.read(File.join(@pgdir, format('/src/include/%s.h', @target_group)))
lines.each_line do |line|
if !@current_struct_def.nil?
handle_struct(line)
elsif !@current_enum_def.nil?
handle_enum(line)
elsif line[/^typedef struct ([A-z]+)\s*(\/\*.+)?$/]
next if IGNORE_LIST.include?($1)
@current_struct_def = { fields: [], comment: @open_comment_text }
@open_comment_text = nil
elsif line[/^typedef enum( [A-z]+)?\s*(\/\*.+)?$/]
next if IGNORE_LIST.include?($1)
@current_enum_def = { values: [], comment: @open_comment_text }
@open_comment_text = nil
elsif line[/^typedef( struct)? ([A-z0-9\s_]+) \*?([A-z]+);/]
next if IGNORE_LIST.include?($2) || IGNORE_LIST.include?($3)
@typedefs << { new_type_name: $3, source_type: $2, comment: @open_comment_text }
@open_comment_text = nil
elsif line.strip.start_with?('/*')
@open_comment_text = line
@open_comment = !line.include?('*/')
elsif @open_comment
@open_comment_text += "\n" unless @open_comment_text.end_with?("\n")
@open_comment_text += line
@open_comment = !line.include?('*/')
end
end
end
end