Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Martin Vieregg

Pages: [1] 2
1
Applications / PDFtk for OS/2 would be nice!
« on: May 30, 2020, 10:07:57 am »
Sometimes I start Windows only for concatenating PDF files to a single PDF file with the commandline tool

pdftk

It is much better than the (?) gs based epdf OS/2 tool.

The name of the commandline version is pdftk-server

Here is the homepage where the source is available.

Here is a part of the docu:
Code: [Select]
EXAMPLES
       Collate scanned pages
         pdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdf
         or if odd.pdf is in reverse order:
         pdftk A=even.pdf B=odd.pdf shuffle A Bend-1 output collated.pdf

       Decrypt a PDF
         pdftk secured.pdf input_pw foopass output unsecured.pdf

       Encrypt a PDF using 128-bit strength (the default), withhold all per-
       missions (the default)
         pdftk 1.pdf output 1.128.pdf owner_pw foopass

       Same as above, except password 'baz' must also be used to open output
       PDF
         pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz

       Same as above, except printing is allowed (once the PDF is open)
         pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing

       Join in1.pdf and in2.pdf into a new PDF, out1.pdf
         pdftk in1.pdf in2.pdf cat output out1.pdf
         or (using handles):
         pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf
         or (using wildcards):
         pdftk *.pdf cat output combined.pdf

       Remove page 13 from in1.pdf to create out1.pdf
         pdftk in.pdf cat 1-12 14-end output out1.pdf
         or:
         pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf

       Apply 40-bit encryption to output, revoking all permissions (the
       default). Set the owner PW to 'foopass'.
         pdftk 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass

       Join two files, one of which requires the password 'foopass'. The out-
       put is not encrypted.
         pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf

       Uncompress PDF page streams for editing the PDF in a text editor (e.g.,
       vim, emacs)
         pdftk doc.pdf output doc.unc.pdf uncompress

       Repair a PDF's corrupted XREF table and stream lengths, if possible
         pdftk broken.pdf output fixed.pdf

       Burst a single PDF document into pages and dump its data to
       doc_data.txt
         pdftk in.pdf burst

       Burst a single PDF document into encrypted pages. Allow low-quality
       printing
         pdftk in.pdf burst owner_pw foopass allow DegradedPrinting

       Write a report on PDF document metadata and bookmarks to report.txt
         pdftk in.pdf dump_data output report.txt

       Rotate the first PDF page to 90 degrees clockwise
         pdftk in.pdf cat 1east 2-end output out.pdf

       Rotate an entire PDF document to 180 degrees
         pdftk in.pdf cat 1-endsouth output out.pdf

It would be really useful to port the project for OS/2. It is available for several Unixes, for Windows and for MacOS. So I assume that porting should be possible with not too much work.

2
Programming is not my main job, and I use WDsibyl Pascal environment and for my few small C projects the old Borland C IDE 2.0 and there was not the need of installing a current C compiler. The feedback with MeShell users show me that a main purpose of MeShell will be to have a better frontend for commandline compilers. I first did not had these users in the focus and now I realize that these programs often generate more stderr output than stdout. So I have to check this purpose myself to find bugs and to get a feeling about the usability of my program with this purpose.

Now I want to install a current C compiler. I assume that meanwhile GCC is the only option after Open Watcom has been abandoned and Borland C for a much longer time. Is Gnu C 8.30 here:
https://smedley.id.au/downloads/gcc-8.3.0-os2-20190324.zip

the right location at the moment? I want to install the "mainstream" compiler, not the newest version. I prefer an easy installation.

How do you work with a commandline compiler? Which source code editors do you use?

3
We already discussed the question how commandline programs with colored text output are working. Meanwhile, I got feedback that several programs like the gcc compiler and other programs coming from Unix do not show colored output in MeShell. So they do not use ESC sequences which run through the pipe without problems. But the VIO window rests empty - in comparison to Laurence which programmed a sample for me (see here) where the output is shown without colors in MeShell and simultaneously colored in the VIO window.

So it seems that there is a third way of showing colored text besides a VIO output to the screen buffer and ESC sequences via Stdout. Can someone explain please how this works? The linked thread contains an attachment with a colored tree.exe. It seems to be an old 16 bit application. It shows colored directory names in the original commandline window, MeShell shows the output without color and the MeShell VIO window rests empty. This behaviour seems to happen often with utilities coming from Unix like gcc.


4
Programming / MeShell and PAUSE in a cmd file
« on: April 15, 2020, 05:29:39 pm »
Meanwhile, I have published a stable beta version of MeShell 0.51 (see Utilities). But there's one problem left where I need your help for brainstorming.

PAUSE is a command which is defined in cmd.exe or 4os2.exe. It does not handle Stdin, but it does also not handle normal VIO keyboard input. I do not understand completely how it works, because a key input into the MeShell original VIO window has no effect. It seems that it is compiled completely internally. And this is a problem for MeShell. In comparison to "MORE", where I programmed an expedient substitute, I have no Idea at the moment how to handle the PAUSE problem. I hope that you have ideas how to handle the problem.

Programming a tiny "pause.exe" does not work because cmd.exe executes "pause" directly without checking the PATH directory list for external programs.

Till now, I found a convenient solution for every problem, and I hope that someone here has an idea how to solve this problem.

5
Programming / how to stay a window on top
« on: April 02, 2020, 09:15:25 pm »
OS/2 distinghishes between a standard "window" and a "dialog window". A visible difference is that a standard window has got an arbitrary icon on the system menu button. A dialog window has only a drop down array icon. Both windows can run in modal and non-modal state. The standard "window" is created with the API call "WinCreateWindow" or "WinCreateStdWindow". A dialog window is created with WinCreateDlg or with WinLoadDlg (from a resource) and a parameter is the address of a message processing function.

An interesting difference in the behaviour of both types of window is that a dialog window continously stays on top, even another window of the program gets the focus, also in non-modal state.

My question: Is there a flag where a window created with WinCreateWindow gets the same behaviour of staying on top like a "dialog window" does?

The reason is that I want to add a specific property to the WDsibyl component library. In Freepascal Lazarus, such a property exists (tForm.Formstyle = fsStayOnTop). The WDsibyl tForm component is completely based on WinCreateWindow, also all standard controls do so.

6
Utilities / MeShell commandline frontend timetable
« on: March 25, 2020, 11:12:03 am »
The last 3 month, I have posted a lot of very OS/2 specific programming questions in the programmers section. Meanwhile, the project of a new OS/2 commandline frontend made a lot of progress. At the moment, I am fixing only minor bugs (false cursorposition in editor...) and the main job is done. A lot of things work better than I originally expected.

What is already done:
- Adaption of the ME editor for the new purpose
- Base cmd.exe functionality (especially cursor up/down command history)
- Base stdin/out functionality
- handling VIO input/output
- User settings notebook, load and save settings
- (soon) saving and restoring output

What I do not implement in the first version 0.5, but for the 1.0 version:
- Command completion with flyover dropdown field (as an user option)
- WPS integration (e.g. doubleclick to a filename from "dir" output opens the file via WPS default connection)
- navigation/history window with a tree, sorted by: Level 1 current directory, Level 2 entered command to jump back into the editor and to restore old commands

But this stuff is much more easier to implement than the stuff which is already done.

I need some help from you for specific jobs:
- I am not an english native speaker (I am german). I need a real native speaker which reads and corrects my english docu. The english docu draft for version 0.5 will be finished in perhaps 1 week and will be extended later.
- If the program should be localized besides english and german, I need help from native speakers. A few text parts (from the WDsibyl environment) are already in nederlands, italian and russian. But first, I have to divide all language specific data from the normal code. Localization makes only sense when the 1.0 version will be nearly finished (in perhaps 2-3 month).

After receiving the corrected english docu, I will publish the first version 0.5. I do not want to publish a version with bugs which are already known and at the moment, I myself find continously minor bugs in daily use and can fix them without problems.


7
Programming / Shared Memory correct usage
« on: March 21, 2020, 11:42:28 am »
I want to use one Shared Memory in both directions. Samples in the internet are poor.

In the server, I wrote:

rc := DosAllocSharedMem(SharedMem, NULL, 4096/*smaller has no effect*/, PAG_WRITE | PAG_READ | PAG_COMMIT | OBJ_GETTABLE);


SharedMem is an untyped pointer.

I transfer the pointer value via commandline parameter to the client.

The pointer value is hold in ulong4.

In the client, I wrote:

      SharedMem = (VOID*) ulong4;
      SharedMem2 = (VOID*) (ulong4+8);
      rc = DosGetSharedMem(SharedMem, PAG_READ | PAG_WRITE);
      PSharedULONG = (PULONG) SharedMem;
      PSharedULONG2 = (PULONG) SharedMem2;

     
I can write the values in the server and read the values in the client, but not reverse (crash). I wrote in the client:

    *PSharedULONG2 = 2;
    //Now it crashes. PSharedULONG also crashes.


Where is my mistake?


8
Programming / Observing if a program uses vio calls
« on: February 25, 2020, 06:49:43 pm »
In the german forum os2.org I started a thread with a problem for my PM commandline frontend, which only supports stdin and stdout, but no VIO calls. If a program writes directly into the screen buffer, my PM window does not show it. So the user has to switch between VIO and PM stdout window - I have got a button in my PM window doing that. It would be useful if the program recognizes automatically if a program which is executed via cmd.exe writes VIO output, so the VIO window could get visible automatically.

My first idea was to analyse the EXE binary and search the string VIOCALLS. In the thread, I was told that there is a better way. The program exehdr.exe from the OS/2 2.45 Toolkit in combination with the following rexx script
Code: [Select]
/* analyse executable import viocalls */
parse upper arg efn SuperfluousArguments
if (efn == '') then return

ifn = 'exehdr.txt'

'@e:\os2ddk\base32\tools\os2.386\bin\exehdr /v 'efn' > 'ifn

needle = ' imp '
do while lines(ifn) <> 0
  haystack = linein(ifn)
  there = pos(needle,haystack)
  if (there > 0) then do
    line = substr(haystack,there+length(needle))
    if (left(line,8)=='VIOCALLS') then say line
    end
  end

return

shows not only the fact that a program uses VIO calls, it shows also the number. The list of VIO calls is here:
Code: [Select]
VIOENDPOPUP             VIOCALLS   1
VIO16ENDPOPUP           VIOCALLS   1
VIOGETPHYSBUF           VIOCALLS   2
VIO16GETPHYSBUF         VIOCALLS   2
VIOGETANSI              VIOCALLS   3
VIO16GETANSI            VIOCALLS   3
VIOSETANSI              VIOCALLS   5
VIO16SETANSI            VIOCALLS   5
VIODEREGISTER           VIOCALLS   6
VIO16DEREGISTER         VIOCALLS   6
VIOSCROLLUP             VIOCALLS   7
VIO16SCROLLUP           VIOCALLS   7
VIOPRTSC                VIOCALLS   8
VIO16PRTSC              VIOCALLS   8
VIOGETCURPOS            VIOCALLS   9
VIO16GETCURPOS          VIOCALLS   9
VIOWRTCELLSTR           VIOCALLS  10
VIO16WRTCELLSTR         VIOCALLS  10
VIOPOPUP                VIOCALLS  11
VIO16POPUP              VIOCALLS  11
VIOSCROLLRT             VIOCALLS  12
VIO16SCROLLRT           VIOCALLS  12
VIOWRTCHARSTR           VIOCALLS  13
VIO16WRTCHARSTR         VIOCALLS  13
VIOSETCURPOS            VIOCALLS  15
VIO16SETCURPOS          VIOCALLS  15
VIOSCRUNLOCK            VIOCALLS  18
VIO16SCRUNLOCK          VIOCALLS  18
VIOWRTTTY               VIOCALLS  19
VIO16WRTTTY             VIOCALLS  19
VIOGETMODE              VIOCALLS  21
VIO16GETMODE            VIOCALLS  21
VIOSETMODE              VIOCALLS  22
VIO16SETMODE            VIOCALLS  22
VIOSCRLOCK              VIOCALLS  23
VIO16SCRLOCK            VIOCALLS  23
VIOREADCELLSTR          VIOCALLS  24
VIO16READCELLSTR        VIOCALLS  24
VIOSAVREDRAWWAIT        VIOCALLS  25
VIO16SAVREDRAWWAIT      VIOCALLS  25
VIOWRTNATTR             VIOCALLS  26
VIO16WRTNATTR           VIOCALLS  26
VIOGETCURTYPE           VIOCALLS  27
VIO16GETCURTYPE         VIOCALLS  27
VIOSAVREDRAWUNDO        VIOCALLS  28
VIO16SAVREDRAWUNDO      VIOCALLS  28
VIOGETFONT              VIOCALLS  29
VIO16GETFONT            VIOCALLS  29
VIOREADCHARSTR          VIOCALLS  30
VIO16READCHARSTR        VIOCALLS  30
VIOGETBUF               VIOCALLS  31
VIO16GETBUF             VIOCALLS  31
VIOSETCURTYPE           VIOCALLS  32
VIO16SETCURTYPE         VIOCALLS  32
VIOSETFONT              VIOCALLS  33
VIO16SETFONT            VIOCALLS  33
VIOMODEUNDO             VIOCALLS  35
VIO16MODEUNDO           VIOCALLS  35
VIOMODEWAIT             VIOCALLS  37
VIO16MODEWAIT           VIOCALLS  37
VIOGETCP                VIOCALLS  40
VIO16GETCP              VIOCALLS  40
VIOSETCP                VIOCALLS  42
VIO16SETCP              VIOCALLS  42
VIOSHOWBUF              VIOCALLS  43
VIO16SHOWBUF            VIOCALLS  43
VIOSCROLLLF             VIOCALLS  44
VIO16SCROLLLF           VIOCALLS  44
VIOREGISTER             VIOCALLS  45
VIO16REGISTER           VIOCALLS  45
VIOGETCONFIG            VIOCALLS  46
VIO16GETCONFIG          VIOCALLS  46
VIOSCROLLDN             VIOCALLS  47
VIO16SCROLLDN           VIOCALLS  47
VIOWRTCHARSTRATT        VIOCALLS  48
VIO16WRTCHARSTRATT      VIOCALLS  48
VIOGETSTATE             VIOCALLS  49
VIO16GETSTATE           VIOCALLS  49
VIOPRTSCTOGGLE          VIOCALLS  50
VIO16PRTSCTOGGLE        VIOCALLS  50
VIOSETSTATE             VIOCALLS  51
VIO16SETSTATE           VIOCALLS  51
VIOWRTNCELL             VIOCALLS  52
VIO16WRTNCELL           VIOCALLS  52
VIOWRTNCHAR             VIOCALLS  53
VIO16WRTNCHAR           VIOCALLS  53
VIOASSOCIATE            VIOCALLS  55
VIO16ASSOCIATE          VIOCALLS  55
VIOCREATEPS             VIOCALLS  56
VIO16CREATEPS           VIOCALLS  56
VIODELETESETID          VIOCALLS  57
VIO16DELETESETID        VIOCALLS  57
VIOGETDEVICECELLSIZE    VIOCALLS  58
VIO16GETDEVICECELLSIZE  VIOCALLS  58
VIOGETORG               VIOCALLS  59
VIO16GETORG             VIOCALLS  59
VIOCREATELOGFONT        VIOCALLS  60
VIO16CREATELOGFONT      VIOCALLS  60
VIODESTROYPS            VIOCALLS  61
VIO16DESTROYPS          VIOCALLS  61
VIOQUERYSETIDS          VIOCALLS  62
VIO16QUERYSETIDS        VIOCALLS  62
VIOSETORG               VIOCALLS  63
VIO16SETORG             VIOCALLS  63
VIOQUERYFONTS           VIOCALLS  64
VIO16QUERYFONTS         VIOCALLS  64
VIOSETDEVICECELLSIZE    VIOCALLS  65
VIO16SETDEVICECELLSIZE  VIOCALLS  65
VIOSHOWPS               VIOCALLS  66
VIO16SHOWPS             VIOCALLS  66
VIOGETPSADDRESS         VIOCALLS  67
VIO16GETPSADDRESS       VIOCALLS  67
VIOGLOBALREG            VIOCALLS  70
VIO16GLOBALREG          VIOCALLS  70
XVIOSETCASTATE          VIOCALLS  71
XVIO16SETCASTATE        VIOCALLS  71
XVIOCHECKCHARTYPE       VIOCALLS  72
XVIO16CHECKCHARTYPE     VIOCALLS  72
XVIODESTROYCA           VIOCALLS  73
XVIO16DESTROYCA         VIOCALLS  73
XVIOCREATECA            VIOCALLS  74
XVIO16CREATECA          VIOCALLS  74
VIOCHECKCHARTYPE        VIOCALLS  75
VIO16CHECKCHARTYPE      VIOCALLS  75
XVIOGETCASTATE          VIOCALLS  76
XVIO16GETCASTATE        VIOCALLS  76

But this solution anlyses only the program code and I do not know if the API calls are really exeuted. For example, XCOPY uses VIO calls, but only in very special circumstances I have not found out yet.

There is a program os2trace  which excatly makes the job I need: Observing an application and journaling which API calls it calls.

The perfect solution would be if my PM program observes the EXE file which is executed via cmd.exe in the known session which is controlled by my program like os2trace does. Is the author Dave Blaschke still acitive? Perhaps he or someone can explain or help me with the code I need. I would need a simple C or Pascal commandline program which observes a specific binary and gets an output "VIOCALL used!" if a VIOcall is sent. Then I could copy these lines into my PM program in an own thread.

9
Programming / different types of keyboard input in cmd.exe
« on: February 19, 2020, 11:07:38 am »
I have recognized another tricky problem for my cmd.exe frontend: The types of keyboard input

There are in my opinion three types of keyboard input which have to be handled different in my editor:

(1) Prompt: The user types input after a prompt, can edit it and sends the input to cmd.exe by pressing ENTER. Before pressing ENTER, cmd.exe does not see any input at all.

(2) program read input: A commandline program requests user input, e.g. a Y/N query, or a string. This input is also finished by pressing ENTER.

An important difference between (1) and (2): In (1), cmd.exe echos the input as stdout. (4os2 does not.)

(3) Collecting text lines via "COPY CON": The editor collects several lines of user input and the input is finished by typing Ctrl-Z. After pressing Ctrl-Z, all lines incl. line end characters (^M^J) are sent to cmd.exe in one step.

In type (3), both cmd.exe and 4os2.exe does not allow to edit the previous lines, you cannot use the up cursor key. (But I will manage this.)

Stdin/out programs always require ENTER after a user input. VIO programs also allow a single keyboard key to continue processing.

My PM editor frontend needs to know which of the three types of keyboard input is current. To distinguish between (1) and (2), I analyze the prompt string which is shown at the beginning of the line.

My question concerns the type (3) "COPY CON": I need to interpretate the command which the user types behind the prompt. My first idea is to search for "<space>CON<space>" ? Which example commands do you have where this type of edit mode gets activated?


10
Programming / Manipulating a PM window from another program
« on: February 17, 2020, 10:23:52 am »
For my commandline frontend, I need to manipulate the VIO window where cmd.exe runs. I have got the window handle. I want to remove buttons in the window title, because the user should neither close the window, nor minimize or maximize. I assume I have to use a WinSetWindow* call and I can use the constant  WS_MAXIMIZEBOX for example. But I did not find any documentation, I only found one for Windows in the Internet. Any hints are appreciated.

11
Programming / problems programming a new text window for cmd.exe/4os2.exe
« on: December 30, 2019, 01:02:08 am »
One year ago, I wrote about my desire to get a substitute for the limited VIO window when using cmd.exe or 4os2.exe without 8000 character limit and with all editor functionality.
https://www.os2world.com/forum/index.php/topic,1859.msg18588.html#msg18588

The last year, I was very busy with other things, but meanwhile I began to program. I am the author of ME Editor and other editors. The editor is an OOP (wdsibyl) project where I can easy manage modifications.

I managed now to excute the original cmd.exe with pipes for stdout, stdin and stderr. The basic input/output functionality works already. But  I need your help with some sophisticated problems.

The editor gets first executed, starts the pipes and executes cmd.exe in the background via
cmd.exe /K >outpipe 2>errorpipe <inpipe

For specific commands like mode, cls the commands will be interpretated by the editor and not cmd.exe, or gets interpretated by both. The current directory will be hold both in the editor and in cmd.exe. I will manage to turn the 4os2 escape codes into colors. All these things seem to make no problems to program (all not programmed yet).

But for three problems I have no solution yet:

(1) While cmd.exe is busy, the editor has to turn into read-only mode. The time period begins with an <ENTER> after typing the command, so the editor knows this moment. But when is the job finished and cmd.exe turns to idle state, the editor should turn to read/write and should accept the next command. I have no idea how the editor can get the information that cmd.exe is in idle state again.

A dirty solution would be to wait for [C:\] or a simular string. But this is not possible. And this is the next problem.

(CHANGED: Problem (2) is non-existant. It was a bug in my editor code.)
(2) A stdout output of cmd.exe waits until the line is finished with an carriagereturn. This has got a strange effect to my program: When starting the program, I do not see [C:\] at the moment. Then I type my command, e.g. "dir", press ENTER and the editor shows the "dir" output. But the last line with the command prompt [C:\] is not shown. It is only shown after entering the next command. Programs with an success indication with dots ...... are invisible while exeuting and waiting. So my question is: Is it possible to force stdout output in cmd.exe when the line is not terminated by a carriagereturn? Or do you have another idea how to sailing round the problem? The only idea for me at the moment is to simulate this output by adding a prompt and to swallow the first line output. Not a pretty solution. And the success dot problem is still not solved.

(3) Not all textmode programs do write into stdout, but there is text output shown nevertheless. This output gets shown in the hidden cmd.exe VIO window and not in my editor window. Can someone explain what this means and perhaps how to get this text in stdout nevertheless?

12
I have got a problem with a print preview function where the size of a font is calculated via the actual window size. Changing the window sizes makes ugly font size steps, because  the FATTRS. lAveCharWidth parameter for GpiCreateLogFont is a integer and not a floating point parameter. The typical values are about 10, so there are 10% steps which really looks ugly.

Other programs manage the problem, e.g. PDF viewers or OpenOffice. Is there a substitute for GpiCreateLogFont or how can I solve this problem?

13
Programming / WinQuerySwitchList Dead Entries
« on: November 28, 2019, 04:56:40 pm »
I am using the WDsibyl Delphi-like programming environment where I made already a lot of minor changes the last 15 years...

I have got a problem with dead entries in the window list when closing windows. In most cases, all works fine, but when closing the main window of a program without closing sub windows before, some specific sub windows do not disappear from the window list which is accessable via WinQuerySwitchList API call. In the OS/2 window list (Ctrl-ESC), they disappear. But e.g. in the MOLE list which is using the WinQuerySwitchList API function, they are still shown and since ArcaOS, shutdown faiis with a query "continue?".

If I understand the OS/2 API correct, the WinDestroyWindow (hwnd) API call should delete the Window from the list. The API call is executed twice, one for the form window and one for the frame. So it should disappear from the list, but it does not.

Any ideas?

14
Setup & Installation / RAM disk does not work anymore
« on: August 07, 2019, 09:00:43 am »
ArcaOS RAM disk does not work anymore. A hardware problem is possible, I had two other programs which does not run anymore (and I could fix it by re-copying the content of C). Four files are used:

c:\os2ldr.cfg (hidden)
file content:
RAMDISK = HPFS PERSIST *:
RAMDISKNAME = Z

c:\os2\boot\HD4DISK.ADD
c:\os2\boot\MEMDISK.ADD

Then there's a setup program with user interface:
C:\sys\bin\HIDISK.EXE

Any ideas what is also needed ? How can I find out why it fails?

15
Setup & Installation / ArcaOS fix for Windows seamless problem ?
« on: April 07, 2019, 11:02:32 pm »
I am waiting for an ArcaOS fix to solve the Win16 seamless windows problem. Does anyone heared about any efforts? On my old computer, it did work with eCS 1.2 and SNAP. Not only the missing seamless functionality is a problem, the performance of the Win16-only drivers is extremeley bad.

Pages: [1] 2