Menu

COB_MOUSE_FLAGS (Windoze)

2024-11-30
2024-12-03
  • A David Wulkan

    A David Wulkan - 2024-11-30

    I am trying to compile the MOUSETEST.cbl program at
    https://sourceforge.net/p/gnucobol/discussion/contrib/thread/2fbc76894c/

    I have this code:
    01 MOUSE-FLAGS PIC 9(4).
    01 MOUSE-FLAGS-AN redefines MOUSE-FLAGS PIC X(4).

    InitialSettings.
    *> sets in order to detect the PgUp, PgDn, PrtSc(screen print), Esc keys,
    set environment 'COB_SCREEN_EXCEPTIONS' TO 'Y'.
    set environment 'COB_SCREEN_ESC'        TO 'Y'.
    display ' ' at 0101 with blank screen end-display. *> initialize pdcurses
    
    *> make mouse active
    COMPUTE MOUSE-FLAGS = COB-AUTO-MOUSE-HANDLING 
                        + COB-ALLOW-LEFT-DOWN 
                        + COB-ALLOW-MIDDLE-DOWN
                        + COB-ALLOW-RIGHT-DOWN
                        + COB-ALLOW-MOUSE-MOVE
      display 'Row & Col.....:' at 1537 
        BACKGROUND-COLOR BCLR FOREGROUND-COLOR FCLR end-display
      display MOUSE-FLAGS       at 1553 
        BACKGROUND-COLOR CLRRED FOREGROUND-COLOR FCLR end-display
      DISPLAY "   Enter Key to continue..."
      accept wDummy at 2580
    
    • SET environment "COB_MOUSE_FLAGS"
    • to FUNCTION NUMVAL(MOUSE-FLAGS-AN).
      SET environment "COB_MOUSE_FLAGS" to MOUSE-FLAGS.

      It compiles without errors but when I run it, I get this message:

      FINISHED!
      C:\EOS\source>mouse
      configuration error:
      invalid value 'mouse-flags' for configuration tag 'COB_MOUSE_FLAGS';
      should be numeric

    If I SET environment "COB_MOUSE_FLAGS" to MOUSE-FLAGS-AN.
    I get this message:

    FINISHED!
    C:\EOS\source>mouse
    configuration error:
    invalid value 'mouse-flags' for configuration tag 'COB_MOUSE_FLAGS';
    should be numeric
    invalid value 'ô' for configuration tag 'COB_MOUSE_FLAGS';
    should be numeric

    From what I've read, COB_MOUSE_FLAGS should be set to a numeric. So, I tried
    SET environment "COB_MOUSE_FLAGS"
    to FUNCTION NUMVAL(MOUSE-FLAGS-AN).

    I get

    FINISHED!
    C:\EOS\source>mouse
    configuration error:
    invalid value 'mouse-flags' for configuration tag 'COB_MOUSE_FLAGS';
    should be numeric
    invalid value 'ô' for configuration tag 'COB_MOUSE_FLAGS';
    should be numeric

    I must be doing something wrong?

     
  • Anonymous

    Anonymous - 2024-12-01
    pdcurses.h   is in C:\EOS\GNUCobol\include
    pdcurses.dll is in C:\EOS\GNUCobol\bin
    
    
    I think my problem is this line: call static "curs_set" using by value wInt end-call ?
    
    Compile with No pdcurses
    ---------------------------------- 
    - CREATE A NON-SQL EXE FILE!       
    ---------------------------------- :
    -----COBOL COMPILE and LINK  Input *.cob  Outputs *.exe-----     
    loading standard configuration file 'default.conf'
    command line:   cobc -fixed -v -x -static -IC:\EOS\cobcpy -LC:\EOS\GNUCobol\lib -o C:\EOS\pgmexe\mousetest.exe C:\EOS\source\Mousetest.cob 
    preprocessing:  C:\EOS\source\Mousetest.cob -> C:\Users\dwulk\AppData\Local\Temp\cob16792_0.cob
    return status:  0
    parsing:    C:\Users\dwulk\AppData\Local\Temp\cob16792_0.cob (C:\EOS\source\Mousetest.cob)
    return status:  0
    translating:    C:\Users\dwulk\AppData\Local\Temp\cob16792_0.cob -> C:\Users\dwulk\AppData\Local\Temp\cob16792_0.c (C:\EOS\source\Mousetest.cob)
    executing:  gcc -c -I C:\EOS\GNUCobol -I"C:\EOS\cobcpy" -o
            "C:\Users\dwulk\AppData\Local\Temp\cob16792_0.o"
            "C:\Users\dwulk\AppData\Local\Temp\cob16792_0.c"
    return status:  0
    executing:  gcc -Wl,--export-all-symbols -Wl,--enable-auto-import
            -Wl,--enable-auto-image-base -o "C:\EOS\pgmexe\mousetest.exe"
            "C:\Users\dwulk\AppData\Local\Temp\cob16792_0.o"
            -L"C:\EOS\GNUCobol\lib" -L/mingw/lib -lcob
    C:\EOS\GNUCobol\bin/ld.exe: C:\Users\dwulk\AppData\Local\Temp\cob16792_0.o:cob16792_0.c:(.text+0xf10): undefined reference to `curs_set'
    collect2.exe: error: ld returned 1 exit status
    return status:  1
    cobc (GnuCOBOL) 3.2.0
    Built     Jul 28 2023 19:10:09  Packaged  Jul 28 2023 17:02:56 UTC
    C version (MinGW) "9.2.0"
    
    --------------------------------------------------------------------------
    Now, compile with pdcurses linked in
    pdcurses not found?  I know for a fact that pdcurses.dll is in C:\EOS\GNUCobol\bin
    
    ---------------------------------- 
    - CREATE A NON-SQL EXE FILE!       
    ---------------------------------- :
    -----COBOL COMPILE and LINK  Input *.cob  Outputs *.exe-----     
    loading standard configuration file 'default.conf'
    command line:   cobc -fixed -v -x -static -IC:\EOS\cobcpy -LC:\EOS\GNUCobol\lib -lC:\EOS\GNUCobol\bin\pdcurses -o C:\EOS\pgmexe\mousetest.exe C:\EOS\source\Mousetest.cob 
    preprocessing:  C:\EOS\source\Mousetest.cob -> C:\Users\dwulk\AppData\Local\Temp\cob18644_0.cob
    return status:  0
    parsing:    C:\Users\dwulk\AppData\Local\Temp\cob18644_0.cob (C:\EOS\source\Mousetest.cob)
    return status:  0
    translating:    C:\Users\dwulk\AppData\Local\Temp\cob18644_0.cob -> C:\Users\dwulk\AppData\Local\Temp\cob18644_0.c (C:\EOS\source\Mousetest.cob)
    executing:  gcc -c -I C:\EOS\GNUCobol -I"C:\EOS\cobcpy" -o
            "C:\Users\dwulk\AppData\Local\Temp\cob18644_0.o"
            "C:\Users\dwulk\AppData\Local\Temp\cob18644_0.c"
    return status:  0
    executing:  gcc -Wl,--export-all-symbols -Wl,--enable-auto-import
            -Wl,--enable-auto-image-base -o "C:\EOS\pgmexe\mousetest.exe"
            "C:\Users\dwulk\AppData\Local\Temp\cob18644_0.o"
            -L"C:\EOS\GNUCobol\lib" -L/mingw/lib -lcob
            -l"C:\EOS\GNUCobol\bin\pdcurses"
    C:\EOS\GNUCobol\bin/ld.exe: cannot find -lC:\EOS\GNUCobol\bin\pdcurses
    collect2.exe: error: ld returned 1 exit status
    return status:  1
    cobc (GnuCOBOL) 3.2.0
    Built     Jul 28 2023 19:10:09  Packaged  Jul 28 2023 17:02:56 UTC
    C version (MinGW) "9.2.0"
    
     
    • Eugenio Di Lorenzo

      you can try to bypass the problem by commenting the statement
      call static "curs_set" using by value wInt end-call
      The program works the same

       
      👍
      1
    • Simon Sobisch

      Simon Sobisch - 2024-12-03

      I'd also suggest to drop that curs_set call and parameter passing.

      Apart from this: you use GCC on win32, which allows to diretly link against a .dll - so you can drop all of the related options and just use C:\EOS\GNUCobol\bin\pdcurses.dll instead. If you have an older version of GnuCOBOL which does not pass it to the linker, then prefix it with -Q option.

       

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.