newt-freebasic header

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

newt-freebasic header

Post by demosthenesk »

i created a github repo for newt.bi header file of newt.
The newt windowing system is a terminal-based window and widget library designed for writing applications with a simple, but user-friendly, interface.
https://userswww.pd.infn.it/~saccarol/tutorial.html

https://github.com/demosthenesk/newt-freebasic

this work is made with the SARG's help, thanks pal! :roll:
Coolman
Posts: 294
Joined: Nov 05, 2010 15:09

Re: newt-freebasic header

Post by Coolman »

hello, I recompiled the source code of Newt :
https://en.wikipedia.org/wiki/Newt_(pro ... g_library)

modified configure to compile with -Os optimization, disable python and tcl support (--without-python --without-tcl). i get :

libnewt.a size 617,0 Kio
libnewt.so size 343,3 Kio

with the command :

strip -s libnewt.a
strip -s libnewt.so

(man strip for more information), i get :

libnewt.a size 60,8 Kio
libnewt.so size 79,8 Kio

all examples work. great job. thanks.
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

Coolman wrote: Oct 03, 2022 11:17 hello, I recompiled the source code of Newt :
https://en.wikipedia.org/wiki/Newt_(pro ... g_library)

modified configure to compile with -Os optimization, disable python and tcl support (--without-python --without-tcl). i get :

libnewt.a size 617,0 Kio
libnewt.so size 343,3 Kio

with the command :

strip -s libnewt.a
strip -s libnewt.so

(man strip for more information), i get :

libnewt.a size 60,8 Kio
libnewt.so size 79,8 Kio

all examples work. great job. thanks.
nice... you are welcomed !!!
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

Together with SARG, we try to bring libnewt.a port to windows.
So far i compiled the libnewt.a with cygwin for win64 with success
We try the examples and we got errors from ld.exe for undefined reference

Code: Select all

Compile File: W:/WORKSPACES/FreeBasic/newt/newt-freebasic-main/win64/test1.bas......

"c:/users/user/bin/freebasic-1.09.0-win64/fbc.exe" -b "W:/WORKSPACES/FreeBasic/newt/newt-freebasic-main/win64/test1.bas"

c:\users\user\bin\freebasic-1.09.0-win64\bin\win64\ld.exe: ./libnewt.a(newt.o):newt.c:(.text+0x8ae): undefined reference to `wcwidth'
c:\users\user\bin\freebasic-1.09.0-win64\bin\win64\ld.exe: ./libnewt.a(newt.o):newt.c:(.text+0x95e): undefined reference to `wcwidth'
c:\users\user\bin\freebasic-1.09.0-win64\bin\win64\ld.exe: ./libnewt.a(newt.o):newt.c:(.text+0x1b63): undefined reference to `nanosleep'

Compile Error!
the functions wcwidth and nanosleep are functions of crt libc which is not implemented in FreeBasic crt
i tried to use libc.a from windows cygwin64 with no success.

Is there any way to overcome these errors ?
Here are the files with libs and examples to try to compile for your self...notice these files are for win64 only so far.
https://drive.google.com/file/d/1z23MNq ... p=drivesdk
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

news:
we eliminate the errors of ld by #inclib "cygwin1" (cygwin1.dll)

the fbc1.09 and fbc1.10 for win64 compiles the code with success.

Unfortunately when we try to run the example it gives no screen just go back to cmd line.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: newt-freebasic header

Post by caseih »

Bear in mind that newt requires some kind of terminal to interpret its commands. Anything built under cygwin assumes a Unix-style terminal, VT100 is the default. If you run it from a windows console window (with cmd.exe) you may not get much. The Windows console is very limited. Try running it under a proper vt100 terminal emulator, or the new Windows Terminal app.
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

caseih wrote: Oct 03, 2022 23:51 Bear in mind that newt requires some kind of terminal to interpret its commands. Anything built under cygwin assumes a Unix-style terminal, VT100 is the default. If you run it from a windows console window (with cmd.exe) you may not get much. The Windows console is very limited. Try running it under a proper vt100 terminal emulator, or the new Windows Terminal app.
the terminal is not the problem.
cygwin compiled also c examples of newt which they run in cmd and in cygwin terminal successfuly.

here is a screenshot of a c example of newt
Image
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: newt-freebasic header

Post by VANYA »

I tried on Linux x86-64. The first tests look very good. Thank you!
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

VANYA wrote: Oct 04, 2022 9:46 I tried on Linux x86-64. The first tests look very good. Thank you!
i am glad you like it !!! 8)
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

news:
angros47 ported the c examples of newt to freebasic
test, testgrid, testtree

check these out !!!
https://github.com/demosthenesk/newt-freebasic
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

newt is based on s-lang.
In cygwin there is a package for s-lang-dev and newt is compiled successfully.
Unfortunately cygwin dlls are not cooperative with freebasic and examples are crashed with segmentation fault!

So i want to try another solution. I will try to compile newt with mingw in Msys2 enviroment.
For this reason i nee to compile also s-lang for Msys2. I tried to do that and i get make errors.
So i open a ticket to Msys2 packages at Github to package s-lang as Msys2 mingw package.
https://github.com/msys2/MINGW-packages ... ions/13394
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: newt-freebasic header

Post by caseih »

Been a long time since I worked with cygwin. Kind of tickles something in the back of my head, though. Could this be a conflict between the MSVCRT dll that mingw links against and the C runtime library that cygwin uses? Since cygwin adds a whole posix emulation layer to the C runtime library, I suspect there will be conflicts when linking against code compiled and linked with mingw. Although I thought the posix stuff was in cygwin1.dll.
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

caseih wrote: Oct 05, 2022 21:14 Been a long time since I worked with cygwin. Kind of tickles something in the back of my head, though. Could this be a conflict between the MSVCRT dll that mingw links against and the C runtime library that cygwin uses? Since cygwin adds a whole posix emulation layer to the C runtime library, I suspect there will be conflicts when linking against code compiled and linked with mingw. Although I thought the posix stuff was in cygwin1.dll.
i compiled newt in cygwin with gcc not mingw.
i tried to compile s-lang with mingw in Msys2 enviroment and it gives error of make file.
demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

demosthenesk
Posts: 237
Joined: Jul 15, 2021 7:23
Location: Greece
Contact:

Re: newt-freebasic header

Post by demosthenesk »

i try to write an example with a callback but it does not work.
i want to click the ok button and clear the screen and a text be written on screen.
Any help?

Code: Select all

#Ifndef NULL
  #Define NULL 0
#Endif

#inclib "newt"
#include "newt.bi"

    dim form as newtComponent
    dim b1 as newtComponent
    dim b2 as newtComponent
	dim p as any Ptr

	sub fCallback(co as newtComponent, data_ as any ptr)
		newtCls()
		newtDrawRootText(0, 0, strptr("I am in callback!"))
		newtRefresh()
	end sub

    
    newtInit()
    newtCls()

    newtOpenWindow(10, 5, 40, 6, "Button Sample")

    b1 = newtButton(10, 1, "Ok")
	newtComponentAddCallback(b1, @fCallback, @p)

    b2 = newtCompactButton(22, 2, "Cancel")
    form = newtForm(NULL, NULL, 0)
    newtFormAddComponents(form, b1, b2, NULL)


    newtRunForm(form)
	sleep
    newtFormDestroy(form)
    newtFinished()
Post Reply