Giter VIP home page Giter VIP logo

netrpg's Introduction

NetRPG

An RPGLE runtime for .NET Core. With this runtime you can run totally free-format RPG code on any system that can run .NET Core.

See wiki for more information.

๐Ÿ”ฅ Features

  • Fully free-format RPG only: write all the latest RPG code in fully free-format.

  • Data-types and complex structures: A majority of the data-types are supported and complex data-structures work too!

  • Full procedure support: Use procedures with parameters by ref, const or value. It all works!

  • Full ILE support: Want to call a procedure from another module? No problem.

  • Display file support: While not everything is supported, we have the base for display file support.

๐Ÿ’พ Installation

  1. Clone repo
  2. Open folder in vscode
  3. Execute dotnet restore to fetch the deps.
  4. To use RLA: setup an .env or env property in your launch.json configuration
    • This needs to include the ODBC connection string: CONN_STRING="Driver=IBM i Access ODBC Driver;System=xxx;UID=xxx;Password=xxx;DBQ=,SAMPLE;Naming=1". While this uses the IBM i driver, you should also be able to use any database that works with ODBC.
  5. Execute project to run unit tests.
    • The RLA tests are setup to work with the IBM i SAMPLE schema.

๐Ÿ’ป Usage

  • Launch NetRPG.dll from the command line:
$ alias netrpg="dotnet bin/Debug/netcoreapp2.0/NetRPG.dll"
$ netrpg RPGCode/op_dsply.rpgle
Hello world
  • Change launch.json in vscode to pass in a parameter to NetRPG.dll: "args": ["RPGCode/dcl_file_exfmt9.rpgle"]

netrpg's People

Contributors

flerka avatar szsascha avatar worksofliam avatar

Stargazers

 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

netrpg's Issues

Expressions in parameters

Testing dcl_proc_10_value.rpgle             ... failed.

	IND Structure(0) 

Procedure: entry: Pointer

	0    ENTRYPOINT      
	1    LDINT           4
	2    LDINT           6
	3    LDINT           1
	4    CALL            ValueParm
	5    RETURN          

Procedure: ValueParm: Character
	ValueParm Int32(10) 

	0    LDVARV          ValueParm
	1    LDINT           1
	2    CALL            %Char
	3    RETURN          

	Expected: '10        '
	Returned: '6'

Dynamic testing

Currently, all tests must be defined in Testing.cs. This can be solved more easily.

It could also be a proper test framework, such as XUnit be used.

I think there are a few more things to be done before the implementation. For example, the restructuring of the project structure. Tests should be in a separate folder.

Internal APIs need passby check

Due to some fairly poor design on my part, we need a way to define an internal functions (BIFs, system APIs) pass type, e.g. by value/const or by reference.

It's different for user defined features because the VM handles whether it's a value or reference (at runtime):


Moral of the story is that Reader.cs somehow needs to know all the internal functions and their reference types in order to construct a correct bytecode, otherwise we may be stuck writing all internal functions as pass by reference only (and I don't think there are any BIFs that have that)

Modules shouldn't share global variables

It looks like when a module is added to the virtual machine (VM class) all the global variables are added to a VM global variable list, when in fact each module has its own set of global variable. The export keyword is what makes it global across all modules, import would allow the user of a program global variable.

https://github.com/worksofliam/NetRPG/blob/master/NetRPG/Runtime/VM.cs#L54

Same goes for shared memory. Shared memory is only across modules, not whole programs.

Proven with this commit: 61551bb

Implement CALL operation

The implementation of the CALL operation can be very useful. CALL should be not only accessible from RPG code. Executing the CALL operation from C# can be really useful too. For example to call RPG programs for testing. (See #19)

Support of older RPG Versions

Is the support for older RPG Versions planned?

I think most of the production applications still use older RPG Versions in fixed format (RPG 3 / fixed ILE and upwards).

Preprocessing of Build-in function arguments

I just created the build-in function %subst (Substring). Following things are not working. I think these things should be processed on a higher level and not in the substring implementation because in other bif's are similar problems.

Case 1: Use substring to change values (working on i)

resultb = 'Hello';
%subst(resultb:1:1) = 'D';

resultb is still "Hello" and not "Dello"

Case 2: Preprocessing of arguments (working on i)

resultb = %subst('Hello World':5+2:10-7);

Failing because of calculations in the second and third argument.

Currently not every test is successful

Hey! Nice idea and project of you! I cloned it immediately after I discovered it.

Unfortunately 2 tests are not working at the moment.

time_bif_time1.rpgle returns "False" instead of "True"

bif_float.rpgle is printing "Float is not a ready data type."

Maybe they are not important but I think with every commit all tests should work. Maybe I'll take a look at it.

%Time built-in does not work with time less or more than 24 hours

Testing time_bif_time1.rpgle                ... 
01:23 PM
1566480180
48180
failed.

	IND Structure(0) 
	MyTime1 Timestamp(0) 

Procedure: entry: Pointer

	0    ENTRYPOINT      
	1    LDGBLD          MyTime1
	2    LDSTR           01:23 PM
	3    LDSTR           hh:mm tt
	4    LDINT           2
	5    CALL            %Time
	6    STORE           
	7    LDSTR           
	8    LDINT           1
	9    CALL            DSPLY
	10   LDGBLV          MyTime1
	11   LDSTR           hh:mm tt
	12   LDINT           2
	13   CALL            %char
	14   LDINT           1
	15   CALL            DSPLY
	16   LDGBLV          MyTime1
	17   LDINT           1
	18   CALL            %char
	19   LDINT           1
	20   CALL            DSPLY
	21   LDINT           48180
	22   LDINT           1
	23   CALL            %char
	24   LDINT           1
	25   CALL            DSPLY
	26   LDGBLV          MyTime1
	27   LDINT           48180
	28   EQUAL           
	29   RETURN          

	Expected: 'True'
	Returned: 'False'

Display input types

Currently, all input boxes allow for numeric or character, even if it's specifically a numeric or character field.

Migrate all ILE sources into one folder

Right now, we have RPG source code in the RPGCode directory and all other objects (like JSON tables and display files) in the objects folder. I believe we should consolidate all that source into one folder.

This means changing hardcoded paths in the some of the code.

Supporting binding directories

Binding directories will have to work a little differently for NetRPG.

A binding directory could simply be a text file, which contains the path to the other modules which will be loaded at runtime.

The VM can may need to include new instructions to load modules (VM#AddModule) at runtime.

ODBC database driver

Implement driver using ODBC. This would allow:

  • RLA functions to be implemented over SQL
  • calling other ILE programs using SQL stored procedures
  • calling other ILE export functions using SQL stored procedures

Consider using reflection in a few classes

There are a few files where initialization via reflection would be pretty useful.

For example:

Testing.cs - Tests could be loaded and activated via annotation
Function.cs (AddFunctionReference) - Same here. It would be easier to just write the function class and add the RPG keyword via annotation or getter.

But this is only a nice to have ;)

Implement conditional fields in Display files

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.