lkc.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  3. * Released under the terms of the GNU GPL v2.0.
  4. */
  5. #ifndef LKC_H
  6. #define LKC_H
  7. #include "expr.h"
  8. #include <libintl.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #ifdef LKC_DIRECT_LINK
  13. #define P(name,type,arg) extern type name arg
  14. #else
  15. #include "lkc_defs.h"
  16. #define P(name,type,arg) extern type (*name ## _p) arg
  17. #endif
  18. #include "lkc_proto.h"
  19. #undef P
  20. #define SRCTREE "srctree"
  21. #define PACKAGE "linux"
  22. #define LOCALEDIR "/usr/share/locale"
  23. #define _(text) gettext(text)
  24. #define N_(text) (text)
  25. int zconfparse(void);
  26. void zconfdump(FILE *out);
  27. extern int zconfdebug;
  28. void zconf_starthelp(void);
  29. FILE *zconf_fopen(const char *name);
  30. void zconf_initscan(const char *name);
  31. void zconf_nextfile(const char *name);
  32. int zconf_lineno(void);
  33. char *zconf_curname(void);
  34. /* confdata.c */
  35. extern const char conf_def_filename[];
  36. extern char conf_filename[];
  37. char *conf_get_default_confname(void);
  38. /* kconfig_load.c */
  39. void kconfig_load(void);
  40. /* menu.c */
  41. void menu_init(void);
  42. void menu_add_menu(void);
  43. void menu_end_menu(void);
  44. void menu_add_entry(struct symbol *sym);
  45. void menu_end_entry(void);
  46. void menu_add_dep(struct expr *dep);
  47. struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
  48. struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
  49. void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
  50. void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
  51. void menu_finalize(struct menu *parent);
  52. void menu_set_type(int type);
  53. /* util.c */
  54. struct file *file_lookup(const char *name);
  55. int file_write_dep(const char *name);
  56. struct gstr {
  57. size_t len;
  58. char *s;
  59. };
  60. struct gstr str_new(void);
  61. struct gstr str_assign(const char *s);
  62. void str_free(struct gstr *gs);
  63. void str_append(struct gstr *gs, const char *s);
  64. void str_printf(struct gstr *gs, const char *fmt, ...);
  65. const char *str_get(struct gstr *gs);
  66. /* symbol.c */
  67. void sym_init(void);
  68. void sym_clear_all_valid(void);
  69. void sym_set_changed(struct symbol *sym);
  70. struct symbol *sym_check_deps(struct symbol *sym);
  71. struct property *prop_alloc(enum prop_type type, struct symbol *sym);
  72. struct symbol *prop_get_symbol(struct property *prop);
  73. static inline tristate sym_get_tristate_value(struct symbol *sym)
  74. {
  75. return sym->curr.tri;
  76. }
  77. static inline struct symbol *sym_get_choice_value(struct symbol *sym)
  78. {
  79. return (struct symbol *)sym->curr.val;
  80. }
  81. static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval)
  82. {
  83. return sym_set_tristate_value(chval, yes);
  84. }
  85. static inline bool sym_is_choice(struct symbol *sym)
  86. {
  87. return sym->flags & SYMBOL_CHOICE ? true : false;
  88. }
  89. static inline bool sym_is_choice_value(struct symbol *sym)
  90. {
  91. return sym->flags & SYMBOL_CHOICEVAL ? true : false;
  92. }
  93. static inline bool sym_is_optional(struct symbol *sym)
  94. {
  95. return sym->flags & SYMBOL_OPTIONAL ? true : false;
  96. }
  97. static inline bool sym_has_value(struct symbol *sym)
  98. {
  99. return sym->flags & SYMBOL_NEW ? false : true;
  100. }
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif /* LKC_H */