lkc.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #if 0
  24. #define _(text) gettext(text)
  25. #define N_(text) (text)
  26. #else
  27. #define _(text) (text)
  28. #define N_(text) (text)
  29. #define setlocale(a,b)
  30. #define bindtextdomain(p,l)
  31. #define textdomain(p)
  32. #endif
  33. int zconfparse(void);
  34. void zconfdump(FILE *out);
  35. extern int zconfdebug;
  36. void zconf_starthelp(void);
  37. FILE *zconf_fopen(const char *name);
  38. void zconf_initscan(const char *name);
  39. void zconf_nextfile(const char *name);
  40. int zconf_lineno(void);
  41. char *zconf_curname(void);
  42. /* confdata.c */
  43. extern const char conf_def_filename[];
  44. extern char conf_filename[];
  45. char *conf_get_default_confname(void);
  46. /* kconfig_load.c */
  47. void kconfig_load(void);
  48. /* menu.c */
  49. void menu_init(void);
  50. void menu_add_menu(void);
  51. void menu_end_menu(void);
  52. void menu_add_entry(struct symbol *sym);
  53. void menu_end_entry(void);
  54. void menu_add_dep(struct expr *dep);
  55. struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
  56. struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
  57. void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
  58. void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep);
  59. void menu_finalize(struct menu *parent);
  60. void menu_set_type(int type);
  61. /* util.c */
  62. struct file *file_lookup(const char *name);
  63. int file_write_dep(const char *name);
  64. struct gstr {
  65. size_t len;
  66. char *s;
  67. };
  68. struct gstr str_new(void);
  69. struct gstr str_assign(const char *s);
  70. void str_free(struct gstr *gs);
  71. void str_append(struct gstr *gs, const char *s);
  72. void str_printf(struct gstr *gs, const char *fmt, ...);
  73. const char *str_get(struct gstr *gs);
  74. /* symbol.c */
  75. void sym_init(void);
  76. void sym_clear_all_valid(void);
  77. void sym_set_changed(struct symbol *sym);
  78. struct symbol *sym_check_deps(struct symbol *sym);
  79. struct property *prop_alloc(enum prop_type type, struct symbol *sym);
  80. struct symbol *prop_get_symbol(struct property *prop);
  81. static inline tristate sym_get_tristate_value(struct symbol *sym)
  82. {
  83. return sym->curr.tri;
  84. }
  85. static inline struct symbol *sym_get_choice_value(struct symbol *sym)
  86. {
  87. return (struct symbol *)sym->curr.val;
  88. }
  89. static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval)
  90. {
  91. return sym_set_tristate_value(chval, yes);
  92. }
  93. static inline bool sym_is_choice(struct symbol *sym)
  94. {
  95. return sym->flags & SYMBOL_CHOICE ? true : false;
  96. }
  97. static inline bool sym_is_choice_value(struct symbol *sym)
  98. {
  99. return sym->flags & SYMBOL_CHOICEVAL ? true : false;
  100. }
  101. static inline bool sym_is_optional(struct symbol *sym)
  102. {
  103. return sym->flags & SYMBOL_OPTIONAL ? true : false;
  104. }
  105. static inline bool sym_has_value(struct symbol *sym)
  106. {
  107. return sym->flags & SYMBOL_NEW ? false : true;
  108. }
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #endif /* LKC_H */