Page 1 of 3

Build system - COBOL

Posted: 15.06.2023 02:35
by Paolo_R
It appears that it is possible to compile and run programs developed in CudaText. I would like to be able to compile/run COBOL programs using either a MIcro Focus compiler or the GNUCobol compiler. Is there a tutorial on how to do this?

Thanks

Posted: 15.06.2023 05:27
by main Alexey
Yes, we have 2 plugins to run tools.

8 External Tools
8.1 Introduction to External Tools
8.2 Tool to compile by GCC
8.3 Tool to run C program
etc
9 Runner
9.1 Runner limitation for input
9.2 Runner tool for C
9.3 Runner tool for C++
etc

https://wiki.freepascal.org/CudaText_plugins

Posted: 17.06.2023 00:33
by Paolo_R
Thanks Alexey. I'll study the wiki :-)

Plug in doessn't appear in 'Install'

Posted: 29.06.2023 05:49
by Paolo_R
I have a COBOL plugin - OpenCOBOL.sublime-build - which I have put in the CudaText -> data -> buildsystems folder along with the other *.sublime-builds.
However when I attempt to install it via Plugins -> Addons Manager -> Install the COBOL item does not appear in the Install drop down dialogue and, therefore, I cannot install it.

Please advise :!:

Posted: 29.06.2023 07:53
by main Alexey
OpenCOBOL.sublime-build is NOT a plugin (for Cudatext).
you don't need to install it.
it is the data file for the RUNNER plugin.
so you need the Runner plugin installed.

also you need the COBOL lexer from Addons Manager.
what does Runner show when you try to call the tool?

Docs:
9 Runner
9.1 Runner limitation for input
9.2 Runner tool for C
9.3 Runner tool for C++
9.4 Runner tool for PHP
9.5 Runner tool for Python
9.6 Runner tool for Free Pascal

https://wiki.freepascal.org/CudaText_plugins

Posted: 29.06.2023 08:04
by main Alexey
please don't open more topics forr the same question (Colol tool).

Posted: 30.06.2023 01:55
by Paolo_R
Alexey

I apologise for my confusion. I am struggling with the syntax of the build systems. I have modified OpenCOBOL.sublime-build as follows:

Code: Select all

{
  "selector": "source.cobol",
  "cmd": [
    "cobc -x -std=mf  c:\workarea\gnucobol\beeb\bbcb.cbl -o beeb.exe -W"
  ],
  "working_dir": "$file_path",
  "shell": true,
  "file_regex": "^([^:]+):([0-9]+):",
  "osx": {
    "env": {
      "PATH": "/usr/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:~/bin:$PATH"
    }
  },
  "linux": {
    "env": {
      "PATH": "/usr/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:~/bin:$PATH"
    }
  }
}
I am not sure how - other than to hard code the path and file name - to specify the file (and its location) to be compiled.

When I run Runner and state 'Build' CudaText gives a message: "No command "Build" in build system "OpenCOBOL"". The command cobc -x is the command to compile with OpenCOBOL (now called GnuCOBOL). Also I don't need the 'osx' and 'linux' sections for my use.

Thanks

Posted: 30.06.2023 08:53
by main Alexey
Also I don't need the 'osx' and 'linux' sections for my use.
then you can ignore keys "osx" and "linux". these keys will be auto ignored.
"selector": "source.cobol",
this is maybe the culprit. Runner-plugin cannot handle this line. it is SublimeText only. for Runner, see how FreePascal build-system specifies the file:

Code: Select all

{
  "file_patterns": ["*.pp", "*.pas", "*.lpr"],
  "file_regex": "(.+?)\\((\\d+),(\\d+)\\)\\s(.+)$",
  "working_dir": "$file_path",
  "name": "Compile",
  "cmd": ["/home/user/fpcupdeluxe/fpcupdeluxe/fpc/bin/x86_64-linux/fpc.sh", "$file_name"],
  "variants": [
    {
      "name": "Run",
      "cmd": ["./$file_base_name"]
    }
  ]
}
this is OK detect of file name:
"file_patterns": ["*.pp", "*.pas", "*.lpr"],
so for Cobol lexer, try to add this:
"file_patterns": ["*.cob", "*.cbl"],

Posted: 30.06.2023 08:55
by main Alexey
if still it don't work, tell be where to download the Cobol compiler and I will try to test.

Posted: 30.06.2023 09:47
by main Alexey
merged two Cobol build system topics into one.