Discussions related to Visual Prolog
augustinharrison
Active Member
Posts: 29
Joined: 28 Jul 2010 1:28

vip7.5 to 10

Unread post by augustinharrison »

i upgraded to version 10. all went well except the binary pointer changes.


what would i do with this binaryToString clause to read a socket msg?

Code: Select all

     port_hand(Socket, msglayer::e_readbin(Bin)):-                 binaryToString(Bin, RequestStr),

this has to change:

Code: Select all

   clauses         binaryToString(Bin, Str):-             Len = binary::getSize(Bin),             StrAnsi = string8::create(Len),             Source = uncheckedConvert(pointer, Bin),             Dest = uncheckedConvert(pointer, StrAnsi),             memory::move(Dest, Source, Len),             Str = string8::mapToString(StrAnsi).
another error i havent solved:

Code: Select all

    domains         guard = () determ ().
gives a e150 error
and

Code: Select all

  sqleval_GetDataVal(core::gmtTimeValue(GmtTimeValue), text(Date)) :-     GmtTime = core::gmtTimeValue(GmtTimeValue),     Time       = time::new(GmtTime),     Date       = Time:formatDate("yyyy-MM-dd"),!.
gives a e504 error


i went through the compile using add all and delete all and came to this. it was
much easier than i expected. if i can get these 3 fixed i think im in business!!!

thanks
aeh
User avatar
Thomas Linder Puls
VIP Member
Posts: 1395
Joined: 28 Feb 2000 0:01

Re: vip7.5 to 10

Unread post by Thomas Linder Puls »

I do not understand the first problem.

Regarding the second: you may notice that guard is blue. This is because it is a keyword in Vip10 (Monitors). So you will have to change the name of that domain.

Regarding the third problem. You are looking for time::newFromGMT:

Code: Select all

clauses     sqleval_GetDataVal(gmtTimeValue(GmtTimeValue), Date) :-         Time = time::newFromGMT(GmtTimeValue),         Date = Time:formatDate("yyyy-MM-dd"),         !.
Have you tried switching Auto-format source files on in Project -> Settings ... -> Build Options? (It is a rhetorical question; I can see from your code that you haven't :-))
Regards Thomas Linder Puls
PDC
augustinharrison
Active Member
Posts: 29
Joined: 28 Jul 2010 1:28

Re: vip7.5 to 10

Unread post by augustinharrison »

sorry i was not clear.

Code: Select all

    port_hand(Socket, msglayer::e_readbin(Bin)):-       binaryToString(Bin,RequestStr),  ........     clauses         binaryToString(Bin, Str):-             Len = binary::getSize(Bin),             StrAnsi = string8::create(Len),             Source = uncheckedConvert(pointer, Bin),             Dest = uncheckedConvert(pointer, StrAnsi),             memory::move(Dest, Source, Len),             Str = string8::mapToString(StrAnsi).
is blowing up with a 504 error which i attached. something about binary and pointer with uncheckedConvert. i read the release notes
about that but cant make it work. is there a better way to read a string from a binary now?
Attachments
ERR.PNG
ERR.PNG (25.23 KiB) Viewed 39705 times
aeh
User avatar
Thomas Linder Puls
VIP Member
Posts: 1395
Joined: 28 Feb 2000 0:01

Re: vip7.5 to 10

Unread post by Thomas Linder Puls »

I should/could have compiled the code (or looked more carefully).

Anyways, the representation of binaries have changed (Visual Prolog 10 Upgrade Notes).

So you could use convert instead:

Code: Select all

Source = convert(pointer, Bin),
or the extension predicate binary::data:

Code: Select all

Source = Bin:binary::data(),
You should however notice the predicate string8::fromUtf8_binary

Code: Select all

predicates     fromUtf8_binary : (binary Utf8) -> string Output.     % @short #Utf8 is a binary with unicode (utf-8) characters.     % #Output is the utf-16 representation of those characters.     % @end
But that (obviously) requires that your binary contains an utf8 string (utf8 have the basic (7-bit) ASCII
characters as subset).
Regards Thomas Linder Puls
PDC
augustinharrison
Active Member
Posts: 29
Joined: 28 Jul 2010 1:28

Re: vip7.5 to 10

Unread post by augustinharrison »

I just noticed this and wanted to thank you. vip 7.5 to 10 upgrade went extremely well and all errors are corrected. I am very happy to be on your current version and it was definitely worth doing and
much easier and faster than I expected. Keep up the good work.

AEHarrison
aeh
Post Reply