Printing to stout inside a Squeak plugin class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Printing to stout inside a Squeak plugin class

Robert Withers-2
 
I wish to print some debugging info to stdout when calling a primitive. How can I do this in Squeak primitive code?

I am attaching a file I created under platforms/. I will attempt to call these functions from inside a primitive. Stay tuned...

Kindly,
Robert
. .. ... ‘...^,^


Sent from Europa iPhone

sqUnixDebug.c (244 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Printing to stout inside a Squeak plugin class

Robert Withers-2
 

I tried to define a header file in platforms/Cross/plugins/RSPlugin/sqDebug.h, bt to no avail. mvm says can;t file it. Otherwise, mvm can't find these functions, even if sqDebug.c is being compiked and linked, which I believe it is, but not sure.

How can I print to stdout?

Andalso, if I have to write functions to print, where do I put the header file such that mvm willl properly compile and link sqDebug.c?

---
Kindly,
Robert


On 6/15/21 7:15 AM, Robert Withers wrote:
I wish to print some debugging info to stdout when calling a primitive. How can I do this in Squeak primitive code?

I am attaching a file I created under platforms/. I will attempt to call these functions from inside a primitive. Stay tuned...

Kindly,
Robert
. .. ... ‘...^,^


Sent from Europa iPhone

sqDebug.h (136 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Printing to stout inside a Squeak plugin class

Levente Uzonyi
In reply to this post by Robert Withers-2
 
Hi Robert,

On Tue, 15 Jun 2021, Robert wrote:

> I wish to print some debugging info to stdout when calling a primitive. How can I do this in Squeak primitive code?

I think currently your only option is to use the #cCode: method. Something
like this:

  | variableToPrint |
  <var: #variableToPrint type: #'unsigned int'>
  variableToPrint := 10.
  self cCode: 'printf("variableToPrint''s value is %u\n", variableToPrint)'


Levente
Reply | Threaded
Open this post in threaded view
|

Re: Printing to stout inside a Squeak plugin class

Robert Withers-2
 
Thanks Levente! Never used this method before, but it looks promising. I
will try after I get my TNC power supply working: digital packet network
over ham radio. I am building it out.

---
Kindly,
Robert


On 6/17/21 1:14 PM, Levente Uzonyi wrote:

> Hi Robert,
>
> On Tue, 15 Jun 2021, Robert wrote:
>
>> I wish to print some debugging info to stdout when calling a primitive. How can I do this in Squeak primitive code?
> I think currently your only option is to use the #cCode: method. Something
> like this:
>
>   | variableToPrint |
>   <var: #variableToPrint type: #'unsigned int'>
>   variableToPrint := 10.
>   self cCode: 'printf("variableToPrint''s value is %u\n", variableToPrint)'
>
>
> Levente