File mod_xml.c

This module kicks out the database in XML format. If you have an XSL-capable browser, you should be able to read these files directly -- and not coincidently eliminate the need for most of the other modules!
Meanwhile, you can still use these with tools like 'nsgmls'.

References Functions: xml_init()mod_xml.c


Included Files


Preprocessor definitions

#define OUTPUT_DIR "xml"

#define OUTPUT_FILE "xml/all.xml"


Type struct item

struct item
struct item 
   { 
     char* name; 
     int flags; 
     int cnt; 
   } 

Global Variable magpie_module

struct magpie_module magpie_module
Included from magpie.h
Visible in:  magpie.c
   mod_conffiles.c
   mod_core.c
   mod_debian.c
   mod_installed.c
   mod_isizes.c
   mod_keywords.c
   mod_maintainers.c
   mod_md5sums.c
   mod_names.c
   mod_priorities.c
   mod_sections.c
   mod_setuids.c
   mod_sizes.c
   mod_sources.c
   mod_tasks.c
   mod_xml.c
   support.c

Global Variable mod_core_xml

struct magpie_module mod_core_xml
Visible in:  magpie.c
   mod_xml.c
Used in:  magpie.c

Local Variables

rcsid
static const char rcsid[]

items
static struct item items[16*1024]
Used in: id_ctor()
  id_declare()
  id_dtor()
  id_store()
  id_undeclared()

itemcnt
static int itemcnt
Used in: id_ctor()
  id_declare()
  id_dtor()
  id_store()
  id_undeclared()

dtd
static const char dtd[]
Used in: xml_packages()
  xml_status()


Local Function id_cmp()

static int id_cmp ( const void* p, const void* q )
Calls: strcoll()
Used in: id_undeclared()mod_xml.c

Local Function id_ctor()

static void id_ctor ( void )
Calls: __builtin_constant_p(), __constant_c_and_count_memset(), __constant_c_memset(), __memset_generic()
Called by: xml_packages()mod_xml.c
  xml_status()mod_xml.c
References Variables: itemcntmod_xml.c
  itemsmod_xml.c

Local Function id_declare()

static void id_declare ( const char* name )
Calls: strcmp(), strdup()
Called by: put_package()mod_xml.c
References Variables: itemcntmod_xml.c
  itemsmod_xml.c

Local Function id_dtor()

static void id_dtor ( void )
Calls: __builtin_constant_p(), __constant_c_and_count_memset(), __constant_c_memset(), __memset_generic(), free()
Called by: xml_packages()mod_xml.c
  xml_status()mod_xml.c
References Variables: itemcntmod_xml.c
  itemsmod_xml.c

Local Function id_store()

static void id_store ( const char* name )
Calls: strcmp(), strdup()
Called by: put_list()mod_xml.c
References Variables: itemcntmod_xml.c
  itemsmod_xml.c

Local Function id_undeclared()

static void id_undeclared ( FILE* fp )
Calls: xml_quote_id()mod_xml.c
  fprintf(), qsort(), strlen()
Called by: xml_packages()mod_xml.c
  xml_status()mod_xml.c
References Functions: id_cmp()mod_xml.c
References Variables: itemcntmod_xml.c
  itemsmod_xml.c

Local Function put_description()

Quote the 'description' field.

static void put_description ( FILE* fp, struct package_info* p )
Calls: xml_quote_data()mod_xml.c
  fprintf()
Called by: put_package()mod_xml.c


Local Function put_list()

static void put_list ( FILE* fp, const char* name, struct package_list* d )
Calls: id_store()mod_xml.c
  fprintf(), fputs()
Called by: put_package()mod_xml.c


Local Function put_package()

Write the XML information about a single package.

static void put_package ( FILE* fp, struct package_info* p )
Calls: id_declare()mod_xml.c
  put_description()mod_xml.c
  put_list()mod_xml.c
  xml_name_value()mod_xml.c
  xml_quote_id()mod_xml.c
  xml_quote_ids()mod_xml.c
  fprintf(), fputc(), sprintf(), strcmp()
Called by: xml_packages()mod_xml.c
  xml_status()mod_xml.c
References Variables: architectures, categories, priorities, sections


Local Function xml_init()

Create basic XML documents

static int xml_init ( void )
Calls: xml_packages()mod_xml.c
  xml_status()mod_xml.c
  mkdir()
Used in:  mod_xml.c


Local Function xml_name_value()

Put a simple "name:value" pair.

static void xml_name_value ( FILE* fp, const char* name, const char* value )
Calls: xml_quote_data()mod_xml.c
  fprintf(), strlen()
Called by: put_package()mod_xml.c


Local Function xml_packages()

Recreate "packages" list in XML format

static void xml_packages ( int sidx )
Calls: gzip()support.c
  id_ctor()mod_xml.c
  id_dtor()mod_xml.c
  id_undeclared()mod_xml.c
  put_package()mod_xml.c
  fclose(), fopen(), fprintf(), sprintf()
Called by: xml_init()mod_xml.c
References Variables: cachemod_debian.c
  cachecntmod_debian.c
  dtdmod_xml.c
  matrixcnt_smod_debian.c
  sections


Local Function xml_quote_attribute()

Quote any text which is written into an 'attribute'.

static void xml_quote_attribute ( FILE* fp, const char* p )
Calls: __assert_fail(), fputc(), fputs()


Local Function xml_quote_data()

Quote any text which is written into a 'data' section.

static void xml_quote_data ( FILE* fp, const char* p )
Calls: __assert_fail(), fputc(), fputs()
Called by: put_description()mod_xml.c
  xml_name_value()mod_xml.c


Local Function xml_quote_id()

Quote any text which is written into an 'id' attribute.

static void xml_quote_id ( FILE* fp, const char* p )
Prototyped in: mod_xml.c
Calls: __assert_fail(), fputc(), fputs()
Called by: id_undeclared()mod_xml.c
  put_package()mod_xml.c
  xml_quote_ids()mod_xml.c


Local Function xml_quote_ids()

static void xml_quote_ids ( FILE* fp, struct package_list* d )
Calls: xml_quote_id()mod_xml.c
  fputc()
Called by: put_package()mod_xml.c


Local Function xml_status()

Recreate "status" list in XML format We don't record conffiles (and other stuff?) yet.

static void xml_status ( void )
Calls: gzip()support.c
  id_ctor()mod_xml.c
  id_dtor()mod_xml.c
  id_undeclared()mod_xml.c
  put_package()mod_xml.c
  fclose(), fopen(), fprintf(), sprintf()
Called by: xml_init()mod_xml.c
References Variables: cachemod_debian.c
  cachecntmod_debian.c
  dtdmod_xml.c