Giter Club home page Giter Club logo

unicon's Introduction

Unicon

Unicon is a very high level programming language. It runs on many operating systems including most Linux distributions, Windows, macOS, and BSD systems. It also supports most modern CPU architectures such as i386, amd64, armhf, arm64, and ppc64el.

Installation

The latest sources are available from Unicon's git repositories on Sourceforge and GitHub. To get the sources from either repo do:

git clone https://github.com/uniconproject/unicon.git

or

git clone git://git.code.sf.net/p/unicon/unicon

On Windows systems it is advised to add the --config core.autocrlf=input option to the git command. git is available on linux via the standard package managers, for example on a Debian system

sudo apt install git

On macOS git is available with xcode. On windows you can install and setup git using the instructions: here

For source tarballs and binary distributions, see unicon.org download page

Build Instructions

Prerequisites

  • Gnu/Unix utilities such as shell, make, grep, etc.
  • C language compiler that supports C99 such as gcc or clang

The initial configuration is done via a standard GNU autoconf script, run:

./configure --help

For configuration options help. On Windows:

sh configure --help

The configuration script allows you to enable or disable features in the Unicon build at compile time. Some of the features are turned on by default as long as the dependecies are satisfied. Those features can be turned off by doing --disable-FEATURE, for example:

./configure --disable-graphics

disables all graphics support. On the other hand, some features are disabled by default. Those can be turned on by doing --enable-FEATURE, for example, to enable operator overloading:

--configure --enable-ovld

One other aspect to consider is that the configure script is opportunistic when it comes to turning on features. Features that are enabled by default will be disabled automatically if they are missing dependencies. If you want to change the behavior to make the configure script stop with an error instead of skipping a feature when its dependencies are missing, just enable that feature explicitly. For example, if you want to enable https/ssl, do:

./configure --enable-ssl

If openssl development library is not present on the system, the configre script will stop with an error message:

configure: error: "ssl requires libssl-dev or equivalent"

Linux

Use the package manager in your Linux distribution to get a build utilities and C compiler. For example, on a Debian system

sudo apt install build-essential

Optionally, you can install development library dependencies to enable more Unicon features. Most of these libraries are listed below for common Linux distibutions.

Debian/Ubuntu:

apt install libgl1-mesa-glx libssl-dev libx11-dev libjpeg-dev libpng-dev libglu1-mesa-dev
            libxft-dev libopenal-dev libalut-dev libogg-dev libvorbis-dev unixodbc-dev
	    libfreetype6-dev

Fedora/Centos (Depending on your Centos version, you may need to replace dnf with yum):

dnf install libjpeg-turbo-devel libpng-devel libX11-devel mesa-libGL-devel mesa-libGLU-devel
            freetype-devel openal-devel freealut-devel libogg-devel libvorbis-devel
	    openssl-devel unixODBC-devel libXft-devel

Go into the Unicon directory and run:

./configure
make

After that you can add unicon/bin to the $PATH environment variable or install Unicon instead:

make install

macOS

Install Xcode command line tools (or all of Xcode) from the macOS app store. After that the build steps are the same as those on Linux. To ensure using clang, explicitly set the compiler as follows:

./configure CC=clang CXX=clang++

If you want access to the graphics facilities of Unicon, you also need to download and install the XQuartz package from https://www.xquartz.org/.

Windows

There are two possibilities depending on the choice of the C runtime library. You can choose the legacy Microsoft Visual C++ Runtime (MSVCRT), which runs on all versions of Windows, or the newer Universal C Runtime (UCRT64), which is used by Visual Studio but is only available by default on Windows 10 and newer. Starting from version 13.3, binary distributions of Unicon for Windows will be built with UCRT64. See msys2 environemts for more details about available environemnts and their C Library options.

1. UCRT64:

  • Download and run the installer from https://www.msys2.org/. At the time of writing it is called msys2-x86_64-20230127.exe but it may be updated from that version.

  • Go through the installation process to get a UCRT64 environment.

  • Using the UCRT64 shell, Install tools required for the build:

pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-diffutils git
  • Install the optional libraries for a full build (Unicon will build without them but some features will be absent).
pacman -S mingw-w64-ucrt-x86_64-openssl  mingw-w64-ucrt-x86_64-libpng mingw-w64-ucrt-x86_64-libjpeg-turbo 
  • Clone the Unicon repository:
git clone --config core.autocrlf=input https://github.com/uniconproject/unicon

The option --config core.autocrlf=input avoids problems with different conventions for the end of line character.

  • Configure Unicon:
./configure --build=x86_64-w64-mingw32

The option x86_64-w64-mingw32 ensures the build is 64-bit. After the script finishes do:

make

Note that, although the build environment is UCRT64, the resulting Unicon binaries may also be run from the standard Windows command line cmd terminal.

2. MSVCRT (Legacy):

  • Download and run mingw-get-setup.exe

    Go through the install process and use it to install only msys-base. This will give you an MSYS (not MSYS2) environment with all the needed Linux/gnu utils.

  • Get MinGW64 compiler suite, TDM package is known to work with Unicon. Most recent package is 9.2.0

Note that you maybe missing the tool "make". TDM MinGW comes with a "make" that is named mingw32-make.exe. That file can be found under the insallation directory of MinGW64 inside the bin directory. create a copy of that file and name it "make.exe" before continuing.

  • Clone the Unicon repository (same steps as UCRT64 above).

After that you can use the standard Windows command line cmd terminal to build Unicon.

sh configure

or

make WUnicon64

Which is a shortcut for running:

sh configure --build=x86_64-w64-mingw32

The option x86_64-w64-mingw32 ensures the build is 64-bit. After the script finishes do:

make

Help

Questions and comments to: [email protected]

unicon's People

Contributors

austin-barr avatar brucerennie avatar cjeffery avatar davidgamey avatar don-ward avatar gkzyoung avatar jafaral avatar jschnet avatar lgtm-migrator avatar matthewclane avatar mj10111 avatar mstow597 avatar mstreeter10 avatar pytholas avatar shnewto avatar stephenwampler avatar tajmone avatar zasharif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unicon's Issues

invoke method is not working

The package lang provides the utility method invoke but it does not work. It was confirmed when I ran objecttests. Unicon version 13.3 on Linux.

Output from unicon/tests/lib/objecttests.icn:

Check to see if d is an instance of Class.

d is NOT an instance of Class!

Test string invocation of method names...should see '123'


List all the methods in class D...

DTest_write

Check the inheritance hierarchy

ATest is NOT an instance of Class
ATest is NOT an instance of BTest
BTest is NOT an instance of ATest
BTest is NOT an instance of BTest
CTest is NOT an instance of Class
CTest is NOT an instance of ATest
DTest is NOT an instance of Class
DTest is NOT an instance of ATest
DTest is NOT an instance of BTest
DTest is NOT an instance of CTest
ETest is NOT an instance of Class
ETest is NOT an instance of FTest
FTest is NOT an instance of ETest

d inherits from: DTest ATest CTest lang::Object

e inherits from: ETest FTest lang::Object ETest

g fields: one two three
h fields: four five six one two three
h.one -> 1
h.one -> One
Attempt to set non-existent field: ok - field doesn't exist

MSYS2 support

For unknown reason, my account @juanchiahsing being flagged by github and hidden from the public. I can't see your replies. I created a new ticket to continue our discussion @Jafaral

13.2 - IDE paths pointing to wrong locations

Hi,

I'm learning Unicon and installed version 13.2.
Couldn't compile the newest commit.

The configuration was done as
./configure --prefix=/usr/local

At the IDE (ui), when I try to access some help, the IDE expects to find the documents at /usr/local/bindoc/utr/.

But the config script have installed them at /usr/local/share/doc/unicon.

Maybe this is already fixed for current version.

But is there a way to change these paths for 13.2?

Couldn't find that option available in the UI.

Thanks.

make now fails when trying to build a main unicon program

With the current github repository attempting to make (with or without -j8) I get a failure when unicon is called to build a main program:

make[3]: Leaving directory '/opt/unicon/uni/udb/dta'
../../bin/unicon -s -c  state

Run-time error 117 in startup code
missing main procedure
make[2]: *** [Makefile:78: state.u] Error 1
make[2]: Leaving directory '/opt/unicon/uni/udb'
make[1]: *** [Makefile:22: nographics] Error 2
make[1]: Leaving directory '/opt/unicon/uni'
make: *** [Makefile:23: default_target] Error 2

Also, attempting to rebuild any Unicon program gives the same error:

->unicon qmazer.icn

Run-time error 117 in startup code
missing main procedure
->

Setting up ulsp on Neovim

Anyone has got ulsp working on Neovim? Neovim expects to connect to an LSP server through vim.lsp.rpc.connect() but ulsp is not listening on the port given. It seems that despite having a server.icn, it is actually a client.

./ulsp --socket 6010
open(:6010) ERROR: Connection refused
open(:6010) ERROR: Connection refused
open(:6010) ERROR: Connection refused
open(:6010) ERROR: Connection refused

Unicon Unit Test Framework

This is an early implementation of an Unicon Unit Test Framework. Your feedback would be invaluable. @cjeffery @StephenWampler @brucerennie @Jafaral

  • TestCase
    • Support setupClass(), teardownClass(), setup and teardown.
    • Assertions through assertEqual(expected, actual), assertNotEqual(unexpected, actual), assert { expression } and assertFail { expression }.
    • TestTestCase unit tests cover TestCase.
  • TestSuite
    • Add a valid TestCase to the test suite.
    • Run the test suite (all the TestCases added).
      • Integration to CI:
        • EXIT SUCCESS when all tests pass.
        • EXIT FAILURE when one or more tests fail.
    • Calculate time elapsed.
    • TestTestSuite unit tests cover TestSuite.
  • TestReporter
    • Add results to the test reporter.
    • Summary of the results.
    • TestTestReporter unit tests cover TestReporter.
  • Mock (very early version)
    • TestMock unit tests cover Mock.

The draft PR is located here: #432
unittest.icn
tests.icn

Permission to Reuse the Sublime Text Syntax in an MIT-Licensed Project

I wanted to ask permission of re-using the config/editor/unicon.sublime-syntax file from this repository to create a derivative work under MIT License.

My goal is to create a full-fledged Sublime Text 4 package for Unicon, and I'd like to use the above file as my starting point and then gradually extend the original syntax file to leverage the new Sublime Text 4 features, as well as adding more package features.

I couldn't find any info about its original author and license, so the only safe assumption is to consider it being under the GNU GPLv2 license governing this repository.

Unfortunately the GPL license(s) don't play out well in the Sublime ecosystem, were the most common license used for packages and assets is the MIT License. Since for my new package I might need to reuse other third party components, the GPL license might lead to license conflict. So, I'm seeking:

  1. Permission to reuse config/editor/unicon.sublime-syntax in an MIT licensed derivate project for an Unicon package for Sublime Text (build >= 4000, aka "Sublime Text 4").
  2. Info about the original author(s) so I can duly credit him/her/them in my package/repository.

JSON package fails to reconstruct a new record

The JSON package fails to reconstruct a new record when the said record has never been used in the code. I suspect the compiler remove unused records and therefore cannot reconstruct the record. The current JSON implementation uses proc for both record and class. A potential solution would be to use constructor() instead.

A working example:

link ximage

import json

record a(b, c)

procedure main()
   ra := a(1, 2)
   ja := utoj(ra)
   jra := jtou(ja)
   jra.b := 3

   write(ja)
   write(ximage(jra))

   raa := jtou("{\"__unirecord__\":\"a\",\"b\":4,\"c\":5}")
   raa.c := 9
   write(ximage(raa))
end

{"__unirecord__":"a","b":1,"c":2}
R_a_3 := a()
   R_a_3.b := 3
   R_a_3.c := 2
R_a_5 := a()
   R_a_5.b := 4
   R_a_5.c := 9

Fails to create a new record n:

link ximage

import json

record a(b, c)
record n(m, o)

procedure main()
   ra := a(1, 2)
   ja := utoj(ra)
   jra := jtou(ja)
   jra.b := 3

   write(ja)
   write(ximage(jra))

   rn := jtou("{\"__unirecord__\":\"n\",\"m\":8,\"o\":7}")
   #rn.c := 9 # Would throw an error
   write(ximage(rn))
end
{"__unirecord__":"a","b":1,"c":2}
R_a_3 := a()
   R_a_3.b := 3
   R_a_3.c := 2
T4 := table(&null)
   T4["__unirecord__"] := "n"
   T4["m"] := 8
   T4["o"] := 7

It will not fail when at least one record has been created, anywhere in the code:

link ximage

import json

record a(b, c)
record n(m, o)

procedure main()
   ra := a(1, 2)
   ja := utoj(ra)
   jra := jtou(ja)
   jra.b := 3

   write(ja)
   write(ximage(jra))

   rn := jtou("{\"__unirecord__\":\"n\",\"m\":8,\"o\":7}")
   rn.o := 9
   write(ximage(rn))

   # Using the record anywhere works
   tn := n(0, 0)
end
{"__unirecord__":"a","b":1,"c":2}
R_a_3 := a()
   R_a_3.b := 3
   R_a_3.c := 2
R_n_2 := n()
   R_n_2.m := 8
   R_n_2.o := 9

A potential solution:

link ximage

import json

record a(b, c)
record n(m, o)

procedure main()
   ra := a(1, 2)
   ja := utoj(ra)
   jra := jtou(ja)
   jra.b := 3

   write(ja)
   write(ximage(jra))

   rn := constructor("n", "m", "o")(8, 7)
   rn.o := 9
   write(ximage(rn))
end
{"__unirecord__":"a","b":1,"c":2}
R_a_3 := a()
   R_a_3.b := 3
   R_a_3.c := 2
R_n_1 := n()
   R_n_1.m := 8
   R_n_1.o := 9

unicon/iconc can't find ft2build.h when compiling

With the following program hello.icn:

procedure main()
  write("Hello, amigo!")
end

Trying to compile with unicon/iconc produces the following error:

❯ unicon -C hello.icn 
Parsing hello.icn: .
Parsing /home/omf/code/icon/unicon/ipl/procs/posix.icn: .........
iconc  -U1  -fs -o hello  -A /tmp/uni79385330 /tmp/uni86049813-iconc /tmp/uni20299443-iconc 
Translating to C:
No errors; no warnings
Compiling and linking C code:
In file included from hello.h:8,
                 from hello.c:13:
/home/omf/code/icon/unicon/rt/include/rt.h:3091:13: fatal error: ft2build.h: No such file or directory
 3091 |    #include <ft2build.h>
      |             ^~~~~~~~~~~~
compilation terminated.
*** C compile and link failed ***

The issue appears to be that ft2build.h is installed in /usr/include/freetype2 but gcc needs to be explicitly told about it. If I explicitly pass the include path it works:

❯ iconc -p '-I/usr/include/freetype2' hello.icn
Translating to C:
hello.icn:
No errors; no warnings
Compiling and linking C code:
Succeeded

I did a quick search and didn't see any other issues mentioning this, so perhaps it's a misconfiguration on my Pop!_OS (Ubuntu-based) system. Any advice would be appreciated.

make install fails on MacOS Monterey but it does build and work properly

I was able to get this to build on MacOS Monterey which is great but the make install does not properly install everything

╰─➤  /usr/local/bin/unicon
[1]    27520 killed     /usr/local/bin/unicon
╰─➤  /usr/local/bin/iyacc
usage: /usr/local/bin/iyacc [--help] [-d[d]] [-ilrtv] [-p symbol_prefix] filename
╰─➤  /usr/local/bin/unidep
[1]    27595 killed     /usr/local/bin/unidep

looking at the /usr/local/bin directory also shows that not every binary was put in there.

╰─➤  ls /usr/local/bin
-rwxr-xr-x  1 root  wheel   332K May 15 20:54 iconc
-rwxr-xr-x  1 root  wheel   169K May 15 20:54 icont
-rwxr-xr-x  1 root  wheel   687K May 15 20:54 iconx
-rwxr-xr-x  1 root  wheel   153K May 15 20:54 iyacc
-rwxr-xr-x  1 root  wheel    50K May 15 20:54 patchstr
-rwxr-xr-x  1 root  wheel   258K May 15 20:54 udb
-rwxr-xr-x  1 root  wheel   205K May 15 20:54 unicon
-rwxr-xr-x  1 root  wheel   134K May 15 20:54 unidep
-rwxr-xr-x  1 root  wheel   289K May 15 20:54 unidoc
-rwxr-xr-x  1 root  wheel    74K May 15 20:54 uprof
╰─➤  ll ~/git/github/unicon/bin
total 7928
-rwxr-xr-x  1 dank  staff   332K May 15 20:53 iconc
-rwxr-xr-x  1 dank  staff   169K May 15 20:52 icont
-rwxr-xr-x  1 dank  staff   687K May 15 20:52 iconx
-rwxr-xr-x  1 dank  staff    48K May 15 20:54 ie
-rwxr-xr-x  1 dank  staff   899K May 15 20:54 ivibmigrate
-rwxr-xr-x  1 dank  staff   153K May 15 20:52 iyacc
-rwxr-xr-x  1 dank  staff    36K May 15 20:53 libcfunc.so
-rwxr-xr-x  1 dank  staff    50K May 15 20:52 patchstr
-rwxr-xr-x  1 dank  staff   258K May 15 20:54 udb
-rwxr-xr-x  1 dank  staff   309K May 15 20:54 uflex
-rwxr-xr-x  1 dank  staff    38K May 15 20:54 umake
-rwxr-xr-x  1 dank  staff   205K May 15 20:53 unicon
-rwxr-xr-x  1 dank  staff   134K May 15 20:54 unidep
-rwxr-xr-x  1 dank  staff   289K May 15 20:54 unidoc
-rwxr-xr-x  1 dank  staff    74K May 15 20:54 uprof
-rwxr-xr-x  1 dank  staff   250K May 15 20:52 urtt

I added the compiled source code bin in my path I can call all the binaries without issue. Figured I'd like y'all know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.