~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to raster/r.mapcalc/xand.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
#include <grass/gis.h>
 
3
#include <grass/raster.h>
3
4
#include "globals.h"
4
5
#include "expression.h"
5
6
#include "func_proto.h"
6
7
 
7
8
/****************************************************************
8
 
and(a,b) = a && b
 
9
and(a,b,c,...) = a && b && c && ...
9
10
****************************************************************/
10
11
 
11
12
int f_and(int argc, const int *argt, void **args)
12
13
{
13
14
    CELL *res = args[0];
14
 
    CELL *arg1 = args[1];
15
 
    CELL *arg2 = args[2];
16
 
    int i;
 
15
    CELL **argz = (CELL **) args;
 
16
    int i, j;
17
17
 
18
 
    if (argc < 2)
 
18
    if (argc < 1)
19
19
        return E_ARG_LO;
20
 
    if (argc > 2)
21
 
        return E_ARG_HI;
22
 
 
23
 
    if (argt[1] != CELL_TYPE || argt[2] != CELL_TYPE)
24
 
        return E_ARG_TYPE;
25
20
 
26
21
    if (argt[0] != CELL_TYPE)
27
22
        return E_RES_TYPE;
28
23
 
 
24
    for (i = 1; i <= argc; i++)
 
25
        if (argt[i] != CELL_TYPE)
 
26
            return E_ARG_TYPE;
 
27
 
29
28
    for (i = 0; i < columns; i++) {
30
 
        if (IS_NULL_C(&arg1[i]) || IS_NULL_C(&arg2[i]))
31
 
            SET_NULL_C(&res[i]);
32
 
        else
33
 
            res[i] = arg1[i] && arg2[i];
 
29
        res[i] = 1;
 
30
        for (j = 1; j <= argc; j++) {
 
31
            if (IS_NULL_C(&argz[j][i])) {
 
32
                SET_NULL_C(&res[i]);
 
33
                break;
 
34
            }
 
35
            if (!argz[j][i])
 
36
                res[i] = 0;
 
37
        }
34
38
    }
35
39
 
36
40
    return 0;