This file is indexed.

/usr/include/genius/dict.h is in genius-dev 1.0.22-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/* GENIUS Calculator
 * Copyright (C) 1997-2009 Jiri (George) Lebl
 *
 * Author: Jiri (George) Lebl
 *
 * This file is part of Genius.
 *
 * Genius is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _DICT_H_
#define _DICT_H_

/*declarations of structures*/
#include "structs.h"

typedef struct _GelContextFrame  GelContextFrame;
struct _GelContextFrame  {
	GelContextFrame *next;

	GSList *functions;
	GSList *substlist;
	GelToken *name;

	gboolean local_all;
};


/*return current context number (0 is global, -1 is uninitialized)*/
int d_curcontext(void) G_GNUC_PURE;

/*make builtin function and return it*/
GelEFunc * d_makebifunc(GelToken *id, GelBIFunction f, int nargs);

/*make a user function and return it*/
GelEFunc * d_makeufunc (GelToken *id, GelETree *value, GSList *argnames, int nargs,
			const GSList *extra_dict);

/*make a variable function and return in*/
GelEFunc * d_makevfunc(GelToken *id, GelETree *value);

/*make a reference function and return it*/
GelEFunc * d_makereffunc(GelToken *id, GelEFunc *ref);

/*copy a function*/
GelEFunc *d_copyfunc(GelEFunc *o);

/*make a real function from a fake*/
GelEFunc * d_makerealfunc(GelEFunc *o,GelToken *id, gboolean use);

/*make real func and replace o with it, without changing o's context or id*/
/*if use is set, we USE the original function, NULLing approriately*/
void d_setrealfunc(GelEFunc *n,GelEFunc *fake, gboolean use);

void d_initcontext(void);

/*add a function struct to the dict (in current context)*/
GelEFunc * d_addfunc (GelEFunc *func);
/*add a function struct to the dict (in global context)*/
GelEFunc * d_addfunc_global (GelEFunc *func);

/*set value of an existing function (in local context), used for arguments
  WARNING, does not free the memory allocated by previous value!*/
gboolean d_setvalue (GelToken *id,GelETree *value);

/*this will work right in all situations*/
void d_set_value(GelEFunc *n,GelETree *value);
void d_set_ref(GelEFunc *n,GelEFunc *ref);

/*dictionary functions*/

/*lookup a function in the dictionary, either the whole thing, or just the
  current context otherwise*/
/*lookup a function in the dictionary in the current context*/
GelEFunc * d_lookup_local(GelToken *id) G_GNUC_PURE;
GelEFunc * d_lookup_global_up1(GelToken *id) G_GNUC_PURE;
GelEFunc * d_lookup_only_global (GelToken *id) G_GNUC_PURE;
/*lookup a function in the dictionary, if there are more return the one in the
  highest context*/
GelEFunc * d_lookup_global (GelToken *id) G_GNUC_PURE;

GelToken * d_intern (const char *id);

gboolean d_delete(GelToken *id);
gboolean d_delete_global(GelToken *id);

/*clear all context dictionaries and pop out all the contexts except
  the global one
  also init the context stack if it hasn't been done*/
void d_singlecontext(void);

/*free all memory allocated by a dictionary*/
void d_freedict(GSList *n);

void d_freefunc(GelEFunc *n);

/*replace old with stuff from new and free new*/
void d_replacefunc (GelEFunc *old, GelEFunc *_new);

/*push a new dictionary onto the context stack*/
gboolean d_addcontext (GelEFunc *func);

/*gimme the last dictinary and pop the context stack*/
void d_popcontext(void);

/*gimme the current dictinary*/
GSList * d_getcontext (void) G_GNUC_PURE;

/* this is a list of lists of the context stack,
 * Also it is a pointer to the current context frame */
GelContextFrame * d_get_all_contexts (void) G_GNUC_PURE;

/*gimme the current global dictinary*/
GSList * d_getcontext_global (void) G_GNUC_PURE;
GSList * d_find_similar_globals (const char *id);

/* Put on subst local var list for this current stack */
void d_put_on_subst_list (GelEFunc *func);

/*protect all variables currently in memory, except for "Ans"*/
void d_protect_all(void);

/* add named arguments to a function.  Note that this APPENDS the
 * list and should only be used for built in functions */
void d_add_named_args (GelEFunc *f, const char *args);

#define D_ENSURE_USER_BODY(f) \
	if G_UNLIKELY ((f)->data.user == NULL) {			\
		g_assert ((f)->id->uncompiled != NULL);			\
		(f)->data.user =					\
			gel_decompile_tree ((f)->id->uncompiled);	\
		(f)->id->uncompiled = NULL;				\
		/* On error give null tree */				\
		if ((f)->data.user == NULL)				\
			(f)->data.user = gel_makenum_null ();		\
	}								\

#define D_ENSURE_SUBST_DICT(f) \
	D_ENSURE_USER_BODY (f);							\
	if ( ! (f)->built_subst_dict) {						\
		(f)->subst_dict = gel_get_ids_for_extradict (NULL,		\
						             (f)->named_args,	\
							     (f)->local_idents,	\
							     (f)->data.user);	\
		(f)->built_subst_dict = 1;					\
	}


#endif