• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/support/kconfig/expr.c
Yann E. MORINYann E. MORIN committed 147be50283c14 Nov 2013
Raw file
Source viewDiff to previous
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
 
1
/*
2
 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3
 * Released under the terms of the GNU GPL v2.0.
4
 */
5
​
6
#include <stdio.h>
7
#include <stdlib.h>
8
#include <string.h>
9
​
10
#include "lkc.h"
11
​
12
#define DEBUG_EXPR  0
13
​
14
struct expr *expr_alloc_symbol(struct symbol *sym)
15
{
16
    struct expr *e = xcalloc(1, sizeof(*e));
17
    e->type = E_SYMBOL;
18
    e->left.sym = sym;
19
    return e;
20
}
21
​
22
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
23
{
24
    struct expr *e = xcalloc(1, sizeof(*e));
25
    e->type = type;
26
    e->left.expr = ce;
27
    return e;
28
}
29
​
30
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
31
{
32
    struct expr *e = xcalloc(1, sizeof(*e));
33
    e->type = type;
34
    e->left.expr = e1;
35
    e->right.expr = e2;
36
    return e;
37
}
38
​
39
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
40
{
41
    struct expr *e = xcalloc(1, sizeof(*e));
42
    e->type = type;
43
    e->left.sym = s1;
44
    e->right.sym = s2;
45
    return e;
46
}
47
​
48
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2)
49
{
50
    if (!e1)
51
        return e2;
52
    return e2 ? expr_alloc_two(E_AND, e1, e2) : e1;
53
}
54
​
55
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2)
56
{
57
    if (!e1)
58
        return e2;
59
    return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
60
}
61
​
62
struct expr *expr_copy(const struct expr *org)
63
{
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.