open-watcom / open-watcom-v2

Open Watcom V2.0 - Source code repository, Wiki, Latest Binary build, Archived builds including all installers for download.
Other
957 stars 157 forks source link

[Questions] Removing unused parts in objects + extending conio + docs only in PDF? #518

Closed spacerace closed 5 years ago

spacerace commented 5 years ago

Hi there,

I started with watcom on a linux host as a dos cross compiler a few weeks ago and I am really excited about it so far. There are just a few things I had to get used to, differences from other toolchains. Mostly the command line usage looks weird to gcc-aware-people, but with some documentation reading it works. This brings me to my first question:

Q1: Are your docs only available in the PDF files in your binary distribution? While these PDFs cover everything it looks, they are not really user friendly. There is a page offset of about 20 pages in the c library doc and there are no bookmarks/links embedded in the PDF. Example: I want to go to function XXX which is on page 526. I type 526 in my PDF reader, but book page it jumps to is ~20 less. So I have to scroll down until I find the function I'm looking for. This makes it a pain to hop between different functions, particularly if you look up more than one function.

It would be really great to have clickable links in book's index. How would one start to add links to existing PDFs like your documentation?

I found these two pages which have some old, but clickable online documentation: http://www.ousob.com/ng/wclr/ http://www.ousob.com/ng/wcpp/index.php https://users.pja.edu.pl/~jms/qnx/help/watcom/clibref/clibover.html Even though the second page is for QNX only, it provides documentation for a large set of functions.

Do you know of more places with stuff like this?

Q2: My code is bloatet by dead stuff - how to optimize unused code automatically away? When I write code and change a lot it happens often that I have a lot of functions in a file where I only use 1 or 2 functions of them. I copy these files from project to project. For example basic windowing stuff in textmode. Brings a lot of functions like "draw_button_xxx..." and so on. My resulting binary with openwatcom is really big, because of the functions still present. I verified this by commenting out the unused functions. This is kind of annoying, because when testing for space savings I can't just comment out the call to the code, I have to comment out the code itself. At least double work. From gcc I am used to a behaviour which kicks out everything unused. Is it possible with watcom too? If so - I didn't find - sorry.

Q3: conio is very limited Compared to other conio implementations conio from openwatcom looks very poor. Is it because of historical reasons? Because watcom never had anything else? The most extensive and great conio I've seen is DJGPP's one. If I would come up with patches that add some functionality to watcom's conio, is there a chance to get it into watcom? If not, I don't want to take that effort. In this case I'd rather stick to my "library files" like described in 2).

I already wrote two conio implementation for dev86/bcc - One of these two conio-implementations uses int21 and BIOS, one uses only BIOS.

These are still on my disk, because work on bcc is stalled. Some small patches of me made it into bcc, but I think their manpower does not go into bcc anymore. linux8086/elks is moving to gcc-ia16, I don't know if my patches would ever made it to bcc. For long time now I wanted to do my own dos-hosted bcc fork with my conio, but I have concerns about usability and I didn't figure out yet how to compile bcc as a native 16bit DOS application, no extenders, ...

Thanks for reading and I hope for response :) Nils

jmalak commented 5 years ago

Hi Nils, I understand you, but Watcom home was OS/2, DOS, Windows in the past, next extended to Novell, QNX. Linux was introduced as new platform by Open Watcom. You can not expect that Open Watcom is gcc/GNU centric. It uses very different philosophy for cross-compilation etc. But we have Compile and Link driver like gcc "owcc" which use same or similar syntax as gcc.

A1: OW uses one documentation source and you can generate various documentation/on-line help format. Travis build create only part of PDF documentation which is available in Wiki to save resources. OW Installers include all types of documentation. If you need different format you can build it or I can compile it for you on my build server.

Available formats are PS, PDF, html, Windows hlp, OS/2 inf, OW on-line text, Windows html Help

A2: use linker option "ELIMINATE" which do this work for you. use also compiler option -zm

A3: you are welcome to improve OW It is not a problem to add anything to OW distribution, but you must follow some rules.

spacerace commented 5 years ago

... owcc .... Yeah, I tried this first, but this way I never get used to the "real" watcom compiler. I have a bunch of Makefiles now for my desired targets and walked all the way through the compiler switch documentation a few times. Getting better, but stil a big new world ;)

ELIMINATE Thanks!! I have missed this.

help formats Thanks again, I will look at the installer/self building and will see if there is something,

different targets Ok, this would involve a lot of testing I assume. I think, I should set up a VM for each target with the corresponding OS (OS2, Win32, DOS, ...) and check if every works, right? Which Versions should I choose? Windows 2000, Windows XP, any later? OS2 4.x or earlier?

fixed prototype + keep existing The idea is to look at other, well known and long existing, implementations for prototypes, pick functions and write them for watcom. This would fit these requirements.

jmalak commented 5 years ago

OW is cross-compiler which doesn need to install it for each target. You need various host only for testing created executables. You can run build for any target on any supported host. If your host is Linux you can compile for all targets on Linux, simply switch environment variable for target and build for appropriate target. here is simple guide how to setup OW for each target OW cross-compile

I am now adding OW html documentation to OW Wiky, that you will be able clicking through current version of html documentation.

jmalak commented 5 years ago

I forgot answer your question about version of Windows. OW C run-time library support any 32-bit Windows from version 3.1 (WIN32S) it include NT 3.1, 3.5, 4.0 etc. Because we use Windows native WIN32 API only the executable should work on any version of Windows. Unfortunately you can run OW 32-bit executable on any 64-bit version too. It is hard to test on all versions. By example I combine test on Windows XP and Windows 10.

jmalak commented 5 years ago

Now html type documentation is available on https://github.com/open-watcom/open-watcom-v2/wiki/Open-Watcom-Documentation-(html)

spacerace commented 5 years ago

Wow thank you so much, this makes things a lot easier :) +10 thumbs up to you for adding it to your wiki :)

That arch linux wiki on watcom helped me a lot when I wrote my set of example-Makefiles :)

zm + ELIMINATE This was exactly what I searched for. The documentation is so big and I used the wrong keywords when searched through the PDFs ;)

different targets / conio Okay, please correct me if I got something wrong: I pick for example DJGPPs conio and look out for missing stuff. For example clreol(), clrscr(), gotoxy() and a few more. I pick one of these per patch, right? One patch would then contain a function, the Makefile + documentation updates.

I have to implement it for different targets. I know how to do it on DOS and/or BIOS and bare metal (directly with a VGA card, not very portable, I think out of question for watcom). For a lot of them I already have working code in other projects, but not for different targets. So I'll have to figure out how to do it on OS/2, Win32, and so on. I think this might be a very good learning excercise + fun for me, but takes a lot of time.

jmalak commented 5 years ago

It was good idea from you to have something similar in wiki to quick access. I only did simple job.

To conio:

jmalak commented 5 years ago

sorry I forgot. You should be familiare with OW building system. We have a few core utilities (builder, pmake, ... )which traverse OW bld tree and run wmake in appropriate directories. Some details you can read in OW Wiki It is not necssary to create new make files. You will do mainly changes to CRTL, it is clib sub-project located in bld/clib there is special make files objects.mif which handle what is build for which target.

Try to do some small change as first and create pull request. We will correct you or explain what is necessary to not lost lot of your time on something what is already done in OW or some OW tools exist which to do it quickly

spacerace commented 5 years ago

Hummm... I took me quite a while to add a dummy-function to libc to figure out how to do it. To be honest - I should have written down my steps - I dont remember em all... I think I was too enthusiastic when thinking about extending the libc. As you said, I have to get familiar to build system etc. I close this now, because it is more an issue of my abilities rather than Watcom ;)

I hope I get all this knowledge quickly to go on with this plan. But for now it is stalled.

Thank you very much!

jmalak commented 5 years ago

If you have any problem then simply ask here and you get help, explanation etc.