Skip to content
Snippets Groups Projects
Select Git revision
  • 29979aa8bd69becd94cbad59093807a417ce2a9e
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

expr.h

Blame
  • expr.h 6.88 KiB
    /*
     * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
     * Released under the terms of the GNU GPL v2.0.
     */
    
    #ifndef EXPR_H
    #define EXPR_H
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include <stdio.h>
    #ifndef __cplusplus
    #include <stdbool.h>
    #endif
    
    struct file {
    	struct file *next;
    	struct file *parent;
    	char *name;
    	int lineno;
    	int flags;
    };
    
    #define FILE_BUSY		0x0001
    #define FILE_SCANNED		0x0002
    
    typedef enum tristate {
    	no, mod, yes
    } tristate;
    
    enum expr_type {
    	E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_LIST, E_SYMBOL, E_RANGE
    };
    
    union expr_data {
    	struct expr *expr;
    	struct symbol *sym;
    };
    
    struct expr {
    	enum expr_type type;
    	union expr_data left, right;
    };
    
    #define EXPR_OR(dep1, dep2)	(((dep1)>(dep2))?(dep1):(dep2))
    #define EXPR_AND(dep1, dep2)	(((dep1)<(dep2))?(dep1):(dep2))
    #define EXPR_NOT(dep)		(2-(dep))
    
    #define expr_list_for_each_sym(l, e, s) \
    	for (e = (l); e && (s = e->right.sym); e = e->left.expr)
    
    struct expr_value {
    	struct expr *expr;
    	tristate tri;
    };
    
    struct symbol_value {
    	void *val;
    	tristate tri;
    };
    
    enum symbol_type {
    	S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
    };
    
    /* enum values are used as index to symbol.def[] */
    enum {
    	S_DEF_USER,		/* main user value */