parsedump.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * libdpkg - Debian packaging suite library routines
  3. * parse.c - declarations for in-core database reading/writing
  4. *
  5. * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
  6. *
  7. * This is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2,
  10. * or (at your option) any later version.
  11. *
  12. * This is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public
  18. * License along with dpkg; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #ifndef DPKG_PARSEDUMP_H
  22. #define DPKG_PARSEDUMP_H
  23. struct fieldinfo;
  24. struct nickname {
  25. const char *nick;
  26. const char *canon;
  27. };
  28. extern const struct fieldinfo fieldinfos[];
  29. extern const struct nickname nicknames[];
  30. extern const int nfields; /* = elements in fieldinfos, including the sentinels */
  31. #define PKGIFPOFF(f) ((char*)(&(((struct pkginfoperfile *)0x1000)->f)) - \
  32. (char*)(struct pkginfoperfile *)0x1000)
  33. #define PKGPFIELD(pifp,of,type) (*(type*)((char*)(pifp)+(of)))
  34. #define FILEFOFF(f) ((char*)(&(((struct filedetails *)0x1000)->f)) - \
  35. (char*)(struct filedetails *)0x1000)
  36. #define FILEFFIELD(filedetail,of,type) (*(type*)((char*)(filedetail)+(of)))
  37. typedef void freadfunction(struct pkginfo *pigp, struct pkginfoperfile *pifp,
  38. enum parsedbflags flags,
  39. const char *filename, int lno, FILE *warnto, int *warncount,
  40. const char *value, const struct fieldinfo *fip);
  41. freadfunction f_name, f_charfield, f_priority, f_section, f_status, f_filecharf;
  42. freadfunction f_boolean, f_dependency, f_conffiles, f_version, f_revision;
  43. freadfunction f_configversion;
  44. typedef void fwritefunction(struct varbuf*, const struct pkginfo*,
  45. const struct pkginfoperfile*, const struct fieldinfo*);
  46. fwritefunction w_name, w_charfield, w_priority, w_section, w_status, w_configversion;
  47. fwritefunction w_version, w_null, w_booleandefno, w_dependency, w_conffiles;
  48. fwritefunction w_filecharf;
  49. struct fieldinfo {
  50. const char *name;
  51. freadfunction *rcall;
  52. fwritefunction *wcall;
  53. int integer;
  54. };
  55. void parseerr(FILE *file, const char *filename, int lno, FILE *warnto, int *warncount,
  56. const struct pkginfo *pigp, int warnonly,
  57. const char *fmt, ...) PRINTFFORMAT(8,9);
  58. void parsemustfield(FILE *file, const char *filename, int lno,
  59. FILE *warnto, int *warncount,
  60. const struct pkginfo *pigp, int warnonly,
  61. char **value, const char *what);
  62. #define MSDOS_EOF_CHAR '\032' /* ^Z */
  63. #endif /* DPKG_PARSEDUMP_H */