Home | History | Annotate | Download | only in engine
      1 /*
      2  * Copyright (C) 2008-2012  OMRON SOFTWARE Co., Ltd.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 
     18 #include "nj_lib.h"
     19 #include "nj_err.h"
     20 #include "nj_ext.h"
     21 
     22 
     23 
     24 
     25 
     26 NJ_INT16 njd_connect_test(NJ_SEARCH_CONDITION *con, NJ_UINT16 hinsiF, NJ_UINT16 hinsiR)
     27 {
     28 
     29 
     30     if (con->hinsi.fore != NULL) {
     31         if (hinsiF == 0) {
     32             return 0;
     33         }
     34 
     35         hinsiF--;
     36         if (hinsiF >= con->hinsi.foreSize) {
     37             return 0;
     38         }
     39         if (*(con->hinsi.fore + (hinsiF / 8)) & (0x80 >> (hinsiF % 8))) {
     40 
     41             if (con->hinsi.foreFlag != 0) {
     42 
     43                 return 0;
     44             }
     45         } else {
     46 
     47             if (con->hinsi.foreFlag == 0) {
     48 
     49                 return 0;
     50             }
     51         }
     52     }
     53 
     54 
     55     if (con->hinsi.rear != NULL) {
     56         if (hinsiR == 0) {
     57             return 0;
     58         }
     59 
     60         hinsiR--;
     61         if (hinsiR >= con->hinsi.rearSize) {
     62             return 0;
     63         }
     64         if (*(con->hinsi.rear + (hinsiR / 8)) & (0x80 >> (hinsiR % 8))) {
     65 
     66             if (con->hinsi.rearFlag != 0) {
     67 
     68                 return 0;
     69             }
     70         } else {
     71 
     72             if (con->hinsi.rearFlag == 0) {
     73 
     74                 return 0;
     75             }
     76         }
     77     }
     78 
     79     return 1;
     80 }
     81