]> cygwin.com Git - cygwin-apps/setup.git/blobdiff - ini.h
2002-07-15 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / ini.h
diff --git a/ini.h b/ini.h
index 9aff36d638e74e48e31d984f5f5a57b92e8e1dbc..e667061b474fe4a1967c960a2e9afb11a3c9a59d 100644 (file)
--- a/ini.h
+++ b/ini.h
 #ifndef _INI_H_
 #define _INI_H_
 
+class io_stream;
+class String;
+class IniState;
+class IniDBBuilder;
+class IniParseFeedback;
+void ini_init (io_stream *, IniDBBuilder *, IniParseFeedback &);
+#define YYSTYPE char *
+
+#ifdef __cplusplus
+
 /* When setup.ini is parsed, the information is stored according to
    the declarations here.  ini.cc (via inilex and iniparse)
    initializes these structures.  choose.cc sets the action and trust
    packages (the chosen "install" field).  install.cc installs
    selected packages. */
 
-/* the classes here store installation info *shrug* */
-/* forward typedefs */
-
-typedef struct _Category Category;
-typedef struct _Package Package;
-
-#include "choose.h"
-
-#define YYSTYPE char *
-
-/* lowest number must be most trusted, highest least trusted */
-typedef enum
-{
-  TRUST_UNKNOWN,
-  TRUST_PREV,
-  TRUST_CURR,
-  TRUST_TEST,
-  NTRUST
-}
-trusts;
-
 typedef enum
 {
   EXCLUDE_NONE = 0,
@@ -52,115 +41,6 @@ typedef enum
 }
 excludes;
 
-#define is_download_action(pkg) \
-  ((pkg)->action == ACTION_PREV || \
-   (pkg)->action == ACTION_CURR || \
-   (pkg)->action == ACTION_TEST || \
-   (pkg)->action == ACTION_REDO || \
-   (pkg)->action == ACTION_SRC_ONLY)
-
-#define is_upgrade_action(pkg) \
-  (((pkg)->action >= ACTION_CURR && \
-    (pkg)->action <= ACTION_TEST) || \
-   (pkg)->action == ACTION_REDO)
-
-#define is_uninstall_action(pkg) \
-  (is_upgrade_action (pkg) || \
-   (pkg)->action == ACTION_PREV || \
-   (pkg)->action == ACTION_UNINSTALL)
-
-#define is_full_action(pkg) \
-  (((pkg)->action >= ACTION_SAME_PREV && (pkg)->action <= ACTION_SAME_TEST) \
-   || (pkg)->action == ACTION_SKIP)
-
-#define SRCACTION_NO           0
-#define SRCACTION_YES          1
-typedef struct _Info
-{
-  char *version;               /* version part of filename */
-  char *install;               /* file name to install */
-  unsigned int install_size;   /* in bytes */
-  int install_exists;          /* install file exists on disk */
-  int derived;                 /* True if we "figured out" that this version should
-                                  go here but it was not in setup.ini */
-  char *source;                        /* sources for installed binaries */
-  unsigned int source_size;    /* in bytes */
-  int source_exists;           /* source file exists on disk */
-#ifdef __cplusplus
-    _Info (const char *_install, const char *_version,
-          int _install_size, const char *_source = NULL,
-          int _source_size = 0);
-#endif
-}
-Info;                          /* +1 for TRUST_UNKNOWN */
-
-typedef struct _CategoryPackage
-{
-  struct _CategoryPackage *next;       /* The next package pointer in the list */
-  char *pkgname;               /* This should be Package *, but the packages can move */
-}
-CategoryPackage;
-
-struct _Category
-{
-  struct _Category *next;      /* the next category in the list */
-  char *name;                  /* the category */
-  CategoryPackage *packages;   /* the packages in this category */
-};
-
-typedef struct _Dependency
-{
-  struct _Dependency *next;    /* the next package in this dependency list */
-  char *package;               /* the name of the package that is depended on */
-}
-Dependency;                    /* Dependencies can be used for
-                                  recommended/required/related... */
-struct _Package
-{
-  char *name;                  /* package name, like "cygwin" */
-  char *sdesc;                 /* short description (replaces "name" if provided) */
-  char *ldesc;                 /* long description (multi-line) */
-  Category *category;          /* the categories the package belongs to */
-  Dependency *required;                /* the packages required for this package to work */
-  actions action;              /* A range of states applicable to this package */
-  trusts trust;                        /* Selects among info[] below, a subset of action */
-  int srcpicked;               /* True if source is required */
-
-  Info *installed;             /* Info on installed package */
-  trusts installed_ix;         /* Index into info array for currently installed package */
-  excludes exclude;            /* true if this package should be excluded */
-
-  /* The reason for this weird layout is to allow for loops that scan either
-     the info array, based on trust value or the infoscan array based on a pointer,
-     looking for a particular version. */
-  Info info[1];                        /* First element.  Intentionally allocated prior
-                                  to infoscan */
-  Info infoscan[NTRUST - 1];   /* +1 for TRUST_UNKNOWN */
-  Info infoend[0];             /* end marker */
-};
-
-extern Package *package;
-extern int npackages;
-extern Category *category;
-extern int ncategories;
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-  Package *new_package (char *name);
-  void ini_init (char *string);
-  Package *getpkgbyname (const char *pkgname);
-  void new_requirement (Package * package, char *dependson);
-  Category *getcategorybyname (const char *categoryname);
-  Category *getpackagecategorybyname (Package * pkg,
-                                     const char *categoryname);
-  Category *register_category (const char *name);
-  void add_category (Package * package, Category * cat);
-
-#ifdef __cplusplus
-}
 #endif
 
-#endif                         /* _INI_H_ */
+#endif /* _INI_H_ */
This page took 0.025265 seconds and 5 git commands to generate.