Build system - COBOL

Plugins for SynWrite and CudaText...
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Build system - COBOL

Post 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
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post 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
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Post by Paolo_R »

Thanks Alexey. I'll study the wiki :-)
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Plug in doessn't appear in 'Install'

Post 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 :!:
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post 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
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

please don't open more topics forr the same question (Colol tool).
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Post 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
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post 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"],
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

if still it don't work, tell be where to download the Cobol compiler and I will try to test.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

merged two Cobol build system topics into one.
Post Reply