This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/pyswip/python.pl

54 lines
1.2 KiB
Perl
Raw Normal View History

2012-10-08 23:58:22 +01:00
%%% -*- Mode: Prolog; -*-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2012-10-17 10:56:44 +01:00
% Author: Vitor Santos Costa
% E-mail: vsc@dcc.fc.up.pt
% Copyright (C): Universidade do Porto
2012-10-08 23:58:22 +01:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
2012-10-17 10:56:44 +01:00
% This file is part of the YAP Python Interface
2012-10-08 23:58:22 +01:00
% distributed according to Perl Artistic License
% check LICENSE file for distribution license
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/** <module> python
A C-based Prolog interface to python.
@author Vitor Santos Costa
2012-10-17 10:56:44 +01:00
@version 0:0:5, 2012/10/8
2012-10-08 23:58:22 +01:00
@license Perl Artistic License
*/
%%%
2012-10-17 10:56:44 +01:00
:- module(python, [
init_python/0,
end_python/0,
python_command/1,
python/3
]).
:- use_module(library(shlib)).
:- use_module(library(lists)).
:- use_module(library(apply_macros)).
:- use_module(library(charsio)).
python(Module:Function, IArgs, OArg) :-
python_import(Module, MRef),
python_f(MRef, Function, FRef),
Args =.. [c|IArgs],
python_apply(FRef, Args, OArg).
2012-10-08 23:58:22 +01:00
python_command(Cmd) :-
python_run_command(Cmd).
start_python :-
use_foreign_library(foreign(python)),
init_python.
% done
:- initialization(start_python, now).