Discussions related to Visual Prolog
Audun Tönnesen
Active Member
Posts: 36
Joined: 27 Apr 2000 23:01

Recreate PRJ-file?

Unread post by Audun Tönnesen »

Hi: I need to revive an old project from 2007 in order to fix a small detail, and then recompile.

Seems I have been stupid and backed up all source-files, but omitted the PRJ-file :oops:

Is there a simple way to recreate the PRJ-file from the other source-files? I use CE 7.1
Regards,
Audun.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

I am not sure how simple it is. But this is how I belive you can do it.

First you create a new project in a new location, but with the old name and kind (GUI/Console+DLL/EXE).

From this new project you copy the .prj6 file to the old project.

Then you open the old project (new .prj6 file). If the IDE complain about missing packages you should most likely accept to remove them from the project.

Next you should build the project and accept to add required files.

You may need to add additional include directories (there is no easy way to figure out what they should be).

Hopefully this will add all necessary .pack files, but if the project lacks #requires directives you may need to add additional packages manually (you wont know which untill you can link the program).

Now all that remains is the hardest part ;-): adding required ressources and giving them the correct identifiers.

If for example you get an error stating that idb_stop is an unknown identifier, then it is likely that you need to add a bitmap file (idb_stop) named stop.bmp (idb_stop) to the project and make sure that its identifier becomes idb_stop.

I hope it helps!
Regards Thomas Linder Puls
PDC
Audun Tönnesen
Active Member
Posts: 36
Joined: 27 Apr 2000 23:01

Unread post by Audun Tönnesen »

Phew!!
That wasn't easy, considering I've been away from Visual Prolog since 2008!

I'm probably now very close to recreating the program, but I've run into a type mismatch, which I don't quite understand, as this project compiled properly 5 yeras ago.

Excuse the long listing, I'll highlight the 2 lines in question, goto %HERE IS THE PROBLEMATIC PART:

clauses
% arity /4
sqlServerRetrieveRows(CONN,AVD,MND,YR):-
searchCriteria(AVD,NYAVD),
searchCriteria(MND,NYMND),
searchCriteria(YR,NYYR),
S = odbcStatement::new(CONN),
SQLSTR = string::format("Select hendelser.refno, hendelser.infek, medisin.id_refno, medisin.antibio, medisin.adm_form, medisin.ordenstall"
" from hendelser, medisin"
" where (hendelser.avd %' and hendelser.mnd %' and hendelser.yr %' and hendelser.refno = medisin.id_refno)"
" order by hendelser.refno, medisin.ordenstall", NYAVD,NYMND,NYYR),
S:prepare(SQLSTR),
S:execute(),

%HERE IS THE PROBLEMATIC PART:


NumCols = S:numResultCols(), %NumCols is domain: fieldIndex)
foreach S:fetch_nd() do
foreach COL = convert(core::positive, programControl::sequence_multi(1, NumCols)) do %NumCols should be domain: integer)
ColName = S:colAttribute_string(COL, odbc_native::sql_desc_name),
ColValue = S:getColumnValue(COL),
CVAL = putBirthMark(ColName,ColValue),
filterOut(ColName,NEWC), % Filter out some ColNames, except those indicated in clauses
resultStr=STR,
resultStr := string::format("%s %s%s", STR, NEWC, printimage(CVAL))
end foreach
end foreach, %printImage(string(S)) = S. % already a string
S:closeCursor(),
S:free().

I thought the convert(core::positive, programControl::sequence_multi(1, NumCols)) took care of the conversion???
Regards,
Audun.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

This is old code so I don't remember how various domains and predicates was defined/declared.

Anyways, the mentioned conversion convert the result of calling programControl::sequence_multi.

But the error is about the argument to this predicate (i.e. NumCols).

This may will help:

Code: Select all

NumCols = S:numResultCols(),foreach S:fetch_nd() do foreach COL = convert(core::positive, programControl::sequence_multi(1, convert(integer, NumCols))) do      ColName = S:colAttribute_string(COL, odbc_native::sql_desc_name),
Regards Thomas Linder Puls
PDC
Audun Tönnesen
Active Member
Posts: 36
Joined: 27 Apr 2000 23:01

Unread post by Audun Tönnesen »

This seems to work: you suggested:

NumCols = S:numResultCols(),
foreach S:fetch_nd() do
foreach COL = convert(core::positive, programControl::sequence_multi(1, convert(integer, NumCols)))do
ColName = S:colAttribute_string(COL, odbc_native::sql_desc_name),

....but I had to do a couple of more changes:

NumCols = S:numResultCols(),foreach S:fetch_nd() do
foreach COL = convert(odbc_native::fieldIndex, std::fromTo(1, convert(integer, NumCols))) do
ColName = S:colAttribute_string(COL, odbc_native::sql_desc_name),

So now the program builds and executes!!!! (on this machine, a development machine)

5 years ago I built the app on another machine. I now get a warning that the OS now isn't compatible, maybe thats why I had to do all those conversions and substitute programControl::sequence_multi with std::fromTo. ???

I still don't know if the program will run flawlessly on the production-machine, where the main SQL-server database is locate d. But thats a database problem, not a VIP-problem.

I'm very grateful for your kind help! Warning: this autumn I'll develop yet another application - so I'll be back :D !
Regards,
Audun.
Post Reply