path to yap

View: New views
5 Messages — Rating Filter:   Alert me  

path to yap

by Ingo Thon-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've the problem that I want to start a new instance of yap from  
within yap using system/1.
Therefor I was wondering whether it is possible to get the  path to  
the current instance of yap.


Thanks ingo

-------------------------------------------------------
Ingo Thon <ingo.thon@...>
Dept. of Computer Science
Katholieke Universiteit Leuven
Phone: +32 16 32 7741
skype: ingo_thon
web: http://www.cs.kuleuven.be/~ingo/
-------------------------------------------------------



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users

Re: path to yap

by Vitor Santos Costa-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ingo,

Actually, that's a difficult question, YAP doesn't support that but I
think that other languages, like ocaml, do have support. So it should
be doable.

Sorry for the delay :(

Vitor

On Wed, Oct 7, 2009 at 1:53 PM, Ingo Thon <ingo.thon@...> wrote:

> Hi,
>
> I've the problem that I want to start a new instance of yap from
> within yap using system/1.
> Therefor I was wondering whether it is possible to get the  path to
> the current instance of yap.
>
>
> Thanks ingo
>
> -------------------------------------------------------
> Ingo Thon <ingo.thon@...>
> Dept. of Computer Science
> Katholieke Universiteit Leuven
> Phone: +32 16 32 7741
> skype: ingo_thon
> web: http://www.cs.kuleuven.be/~ingo/
> -------------------------------------------------------
>
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Yap-users mailing list
> Yap-users@...
> https://lists.sourceforge.net/lists/listinfo/yap-users
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users

Re: path to yap

by Ingo Thon-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 21 Oct 2009, at 01:13, Vitor Santos Costa wrote:
> Hi Ingo,
>
> Actually, that's a difficult question, YAP doesn't support that but I
> think that other languages, like ocaml, do have support. So it  
> should be doable.
Yes it is definitely possible.
The simplest solutionis to just use argv[0],
which seems to be not available to the yap-user.


The problem is storing argv[0] requires changes to the yap sources  
(console/yap.c).
as the command line arguments are  far as I see it nowhere stored.
In general I think it might be not the worst idea to provide all  
arguments
to the prolog envrionment.
Appareantly the calling process can apparently manipulate this.
But still the following code would be in most cases (except yap is  
executed
using non properly initiales the arg structure) output the right result:
static int parse_yap_arguments(int argc, char *argv[], YAP_init_args  
*iap)
{
   char            actualpath[PATH_MAX + 1];
   realpath(argv[0], actualpath);
   printf("> %s <-> %s\n",argv[0],actualpath);


There are actually more general better working approaches like the  
code here
http://www.koders.com/c/fidEC2463ED7BDAD5D8B6CBAF1020498F35D9B3EDD9.aspx
but this also requires to have access to the argument 0.
I included a hacked custom predicate based on that (only tested on a  
mac).
Which would still require in some cases argv[0] (except for: Macos,  
cygwin, linux)



Ingo



>
> Sorry for the delay :(
>
> Vitor
>
> On Wed, Oct 7, 2009 at 1:53 PM, Ingo Thon  
> <ingo.thon@...> wrote:
>> Hi,
>>
>> I've the problem that I want to start a new instance of yap from
>> within yap using system/1.
>> Therefor I was wondering whether it is possible to get the  path to
>> the current instance of yap.
>>
>>
>> Thanks ingo
>>
>> -------------------------------------------------------
>> Ingo Thon <ingo.thon@...>
>> Dept. of Computer Science
>> Katholieke Universiteit Leuven
>> Phone: +32 16 32 7741
>> skype: ingo_thon
>> web: http://www.cs.kuleuven.be/~ingo/
>> -------------------------------------------------------
>>
>>
>>
>> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>>
>> ---------------------------------------------------------------------
>> ---------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year.  
>> Jumpstart your
>> developing skills, take BlackBerry mobile applications to market  
>> and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Yap-users mailing list
>> Yap-users@...
>> https://lists.sourceforge.net/lists/listinfo/yap-users
>>
>
> ----------------------------------------------------------------------
> --------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market  
> and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Yap-users mailing list
> Yap-users@...
> https://lists.sourceforge.net/lists/listinfo/yap-users

-------------------------------------------------------
Ingo Thon <ingo.thon@...>
Dept. of Computer Science
Katholieke Universiteit Leuven
Phone: +32 16 32 7741
skype: ingo_thon
web: http://www.cs.kuleuven.be/~ingo/
-------------------------------------------------------

I distance myself from the disclaimer probably added to this email  
without my request.
Instead the following disclaimer applies.
Notice: Unless you are Zaphod Beeblebrox you are only allowed to read  
the words
containing no ä. If you violated that, then you  owe the sender 5  
euros for each word
containing an ä you have read.

Emails from me do not usually represent the  official policy of the  
K.U. Leuven.




-------------------------------------------------------
Ingo Thon <ingo.thon@...>
Dept. of Computer Science
Katholieke Universiteit Leuven
Phone: +32 16 32 7741
skype: ingo_thon
web: http://www.cs.kuleuven.be/~ingo/
-------------------------------------------------------
I distance myself from the disclaimer probably added to this email  
without my request.
Emails from me do not usually represent the  official policy of the  
K.U. Leuven.


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users

Yap Read Buffer containing illegal characters

by Ingo Thon-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's probably more a convenience as it seems the problem is in my code.

The following code in a custom C++ predicate causes yap into an  
infinite loop
(consuming 100% cpu time).

   parsed = YAP_ReadBuffer("/aa/a", &err);
whereas
   parsed = YAP_ReadBuffer("'/aa/a'", &err);
   parsed = YAP_ReadBuffer("'aaa", &err);
both work.

It's just hard(er) to trace down as
YAP_Term YAP_BufferToString(char *buf )
YAP_Term YAP_BufferToAtomList(char *buf )
both work.


Cheers Ingo

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users

Re: path to yap

by Vitor Santos Costa-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ingo

YAP actually keeps around an Yap_argv and an Yap_argc which hold the
original value of argc,argv. Would argv[0] work on win32?

The Koders code is GPLed, so I can't include it in the main source :(

Cheers

Vitor

On Thu, Oct 22, 2009 at 11:18 PM, Ingo Thon <ingo.thon@...> wrote:

>
> On 21 Oct 2009, at 01:13, Vitor Santos Costa wrote:
>>
>> Hi Ingo,
>>
>> Actually, that's a difficult question, YAP doesn't support that but I
>> think that other languages, like ocaml, do have support. So it should be
>> doable.
>
> Yes it is definitely possible.
> The simplest solutionis to just use argv[0],
> which seems to be not available to the yap-user.
>
>
> The problem is storing argv[0] requires changes to the yap sources
> (console/yap.c).
> as the command line arguments are  far as I see it nowhere stored.
> In general I think it might be not the worst idea to provide all arguments
> to the prolog envrionment.
> Appareantly the calling process can apparently manipulate this.
> But still the following code would be in most cases (except yap is executed
> using non properly initiales the arg structure) output the right result:
> static int parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
> {
>  char            actualpath[PATH_MAX + 1];
>  realpath(argv[0], actualpath);
>  printf("> %s <-> %s\n",argv[0],actualpath);
>
>
> There are actually more general better working approaches like the code here
> http://www.koders.com/c/fidEC2463ED7BDAD5D8B6CBAF1020498F35D9B3EDD9.aspx
> but this also requires to have access to the argument 0.
> I included a hacked custom predicate based on that (only tested on a mac).
> Which would still require in some cases argv[0] (except for: Macos, cygwin,
> linux)
>
>
>
> Ingo
>
>
>
>>
>> Sorry for the delay :(
>>
>> Vitor
>>
>> On Wed, Oct 7, 2009 at 1:53 PM, Ingo Thon <ingo.thon@...>
>> wrote:
>>>
>>> Hi,
>>>
>>> I've the problem that I want to start a new instance of yap from
>>> within yap using system/1.
>>> Therefor I was wondering whether it is possible to get the  path to
>>> the current instance of yap.
>>>
>>>
>>> Thanks ingo
>>>
>>> -------------------------------------------------------
>>> Ingo Thon <ingo.thon@...>
>>> Dept. of Computer Science
>>> Katholieke Universiteit Leuven
>>> Phone: +32 16 32 7741
>>> skype: ingo_thon
>>> web: http://www.cs.kuleuven.be/~ingo/
>>> -------------------------------------------------------
>>>
>>>
>>>
>>> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Yap-users mailing list
>>> Yap-users@...
>>> https://lists.sourceforge.net/lists/listinfo/yap-users
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Yap-users mailing list
>> Yap-users@...
>> https://lists.sourceforge.net/lists/listinfo/yap-users
>
> -------------------------------------------------------
> Ingo Thon <ingo.thon@...>
> Dept. of Computer Science
> Katholieke Universiteit Leuven
> Phone: +32 16 32 7741
> skype: ingo_thon
> web: http://www.cs.kuleuven.be/~ingo/
> -------------------------------------------------------
>
> I distance myself from the disclaimer probably added to this email without
> my request.
> Instead the following disclaimer applies.
> Notice: Unless you are Zaphod Beeblebrox you are only allowed to read the
> words
> containing no ä. If you violated that, then you  owe the sender 5 euros for
> each word
> containing an ä you have read.
>
> Emails from me do not usually represent the  official policy of the K.U.
> Leuven.
>
>
>
>
> -------------------------------------------------------
> Ingo Thon <ingo.thon@...>
> Dept. of Computer Science
> Katholieke Universiteit Leuven
> Phone: +32 16 32 7741
> skype: ingo_thon
> web: http://www.cs.kuleuven.be/~ingo/
> -------------------------------------------------------
> I distance myself from the disclaimer probably added to this email without
> my request.
> Emails from me do not usually represent the  official policy of the K.U.
> Leuven.
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users