Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

Very First Try at C Compilation

Last updated on 6 days ago
N
NathanHMember
Posted 6 days ago
@Farox and @deadwood,

Thanks, that got passed the inline problem. Had to comment out sdResizeFile and sdSleepMillis in the source code and it compiled the pforth executable. Seems to run but the terminal echos input. Looking into fixing that. Also looking at adding custom functions to be able to call AROS library functions like I did in 32-bit parForth. Thanks, this is a great start!

NathanH
D
deadwoodAROS Dev
Posted 6 days ago

Farox wrote:

@Farox - @deadwood
As allways you are right...it was so simple.


Actually you lead me to the solution. Once you confirmed that building with cmake works, I looked at cmake files and noticed that -std=c89 was commented out in them. So it was a team work Smile
F
FaroxMember
Posted 6 days ago

NathanH wrote:

@NathanH - @Farox and @deadwood,

Thanks, that got passed the inline problem. Had to comment out sdResizeFile and sdSleepMillis in the source code and it compiled the pforth executable. Seems to run but the terminal echos input. Looking into fixing that. Also looking at adding custom functions to be able to call AROS library functions like I did in 32-bit parForth. Thanks, this is a great start!

NathanH


Glad that you build it, but in my case i didn't need to comment out sdResizeFile, and i also added (copied from the posix version) the
sdSleepMillis and it compile fine the pForth exe. It passes also all the tests, and i didn't noticed any problem...but i also don't know Forth and never used before, maybe you have more experience with it.
N
NathanHMember
Posted 6 days ago
@Farox,

I first tried the posix version of stdio but got an error so used the regular stdio instead and commented out .POSIX. It complained about undefined sdSleepMillis and sdResizeFile which is why I commented out those sections of code. I'll look through the posix version like you did and may be able to make it work without commenting out like you did. Do you get the echoing? For example, if you type "3 4 +" you should get a new line that says " ok". When I do it it gives me a newline with "3 4 + ok". Thanks.

NathanH
F
FaroxMember
Posted 6 days ago
I excluded the posix .c file because gives error (maybe need more checking) and used the Stdio i modified the makefile to compile

DEBUGOPTS = -g
CCOPTS = $(WIDTHOPT) -x c -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)

#IO_SOURCE = pf_io_posix.c pf_fileio_stdio.c <----- commented line
IO_SOURCE = pf_io_stdio.c pf_fileio_stdio.c <------ modified and enabled line....

EMBCCOPTS = -DPF_STATIC_DIC #-DPF_NO_FILEIO

#######################################

then copied from pf_io_posix.c the function...sdSleepMillis into pf_io_stdio.c

Here is the function to copy....

cell_t sdSleepMillis(cell_t msec)
{
const cell_t kMaxMicros = 500000; /* to be safe, usleep() limit is 1000000 */
cell_t micros;
cell_t napTime;
if (msec < 0) return 0;
micros = msec * 1000;
while (micros > 0)
{
napTime = (micros > kMaxMicros) ? kMaxMicros : micros;
if (usleep(napTime))
{
perror("sdSleepMillis: usleep failed"Wink;
return -1;
}
micros -= napTime;
}
return 0;
}

About Echoing....don't know i attach a shot of the shell
You do not have access to view attachments
N
NathanHMember
Posted 6 days ago
@Farox,

Thanks, I'll try that. Yes, your screenshot shows that your pForth is echoing your input. That is a bug/unwanted feature I'm trying to solve. There is an echo variable in the source but it is set to zero to avoid echoing so something else is going on.

NathanH
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.
Users who participated in discussion: deadwood, AMIGASYSTEM, NathanH, Farox