Print

Print


A problem for all of you from the Bugs team for a change!

 - replies to [log in to unmask] if you have any inspiration.

(and please note we usually only post Bugs related queries on the list!)


------------- Begin Forwarded Message -------------

X-RAL-MFrom: <[log in to unmask]>
X-RAL-Connect: <mr2.cc.ic.ac.uk [155.198.5.112]>
From: "Thomas, Andrew" <[log in to unmask]>
To: "[log in to unmask]" <[log in to unmask]>
Subject: The C monster...
Date: Wed, 18 Jun 2003 14:12:34 +0100
MIME-Version: 1.0

Has anyone got an idea what this bit of CP code would look like in C?


        PROCEDURE Test;
        VAR
                adr, len, res: INTEGER;
                string: ARRAY 64 OF SHORTCHAR;
                arg: ARRAY 1 OF INTEGER;
        BEGIN
                res := -1;
                arg[0] := SYSTEM.ADR(string);
                string := "BugsR.Compile";
                len := LEN(string$)
                BugsDll.CallBUGS(arg, len, res);
                ASSERT(res = 0, 0)
        END Test;

(

The module BugsDll exports a procedure with signiture
        PROCEDURE CallBUGS(VAR arg: ARRAY OF INTEGER; VAR len, res: INTEGER)
what will the C header file look like?
SHORTCHAR is an 8 bit character
SYSTEM.ADR finds the address of the first character in string.
The $ after string denotes the characters in string before the terminal 0X
LEN(string$) is the number of characters in BugsR.Compile

)

Thanks for any help from anyone

-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]

To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.

To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list

------------- End Forwarded Message -------------

-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]

To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.

To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list