IF Computer > IF/Prolog > Manuals > IF/Prolog V4.1 マニュアル > IF/Prolog Interfaces > IF/PrologからC言語へのインタフェ−ス > 開発にさらに便利なIF/Prologライブラリ関数 > ライブラリ関数の概要 > 整数の扱い

整数の扱い

IF/Prolog by Siemens
MINERVA superseeded IF/Prolog. Please see http://www.ifcomputer.co.jp/MINERVA for details.

We discontinued to sell IF/Prolog Dec 31. 2003. For current customers, we continue to provide professional support for IF/Prolog until Dec 31, 2008.

関数名 IsInt IsInteger IntCP IntPC 概要 #include "cpred.h"

int IsInt(T) TERM T;

int IsInteger(EXPRESSION, VALUE) TERM EXPRESSION; INT *VALUE;

TERM IntCP(ARGUMENT) INT ARGUMENT;

INT IntPC(T) TERM T;

IsIntは、その引数が整数の場合には1を返し、それ以外の場合には0を返します。

IsIntegerは、EXPRESSIONが正しい整数式の場合には、1を返します。またEXPRESSIONを評価することによって得られた値が、VALUEとして返されます。(Prologの述語is/2と同等です。)そうでない場合には、0が返されます。

この評価によって次のような述語: B is 10 + 3, my_new_pred(A, B)・・・は、 my_new_pred(A, 10 + 3)・・・ のように書けます。

IntCPは、ARGUMENTを表すProlog TERMを返します。

IntPCは、整数をPrologのTERMからCの表現形式に変換します。もし TERMが整数でない場合には、IF/Prologのセッションをアボ−トします。

注意!:あなたのプログラムには、intとlongのどちらが必要なのでしょうか? IF/Prologでは、Cで書かれたプログラム中の整数に対しては、型INT(long)を使用します。

document: http://www.ifcomputer.co.jp/IFProlog/Manuals/v4.1/advanced_feature/c_interface/libfunc/summ/manint/print_en.html
published 2008/9/1 update 1995/10/12 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS