Laxmikanth said:
> Going forward i would like to know the Limitations of converting this code to Java using any code converters.
Perhaps you could do a survey of the current state of the art and report back here.
A quick web search brought up these sites:
http://www.mumps-migration.com/http://www.nextgov.com/nextgov/ng_20090414_9453.phphttp://www.softwarerevolution.com/bluep ... open-vistaYou should be aware, however, that the FileMan to Java conversion balloons the lines of code.
The ^DI simple dispatch program only has only 459 characters in it, with 153 characters of comments.
DI.m
DI ;SFISC/GFT-DIRECT ENTRY TO VA FILEMAN ;7/25/94 3:07 PM
V ;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
G QQ:$G(^DI(.84,0))']""
C G QQ:$G(^DI(.84,0))']"" K (DTIME,DUZ) G ^DII
D G QQ:$G(^DI(.84,0))']"" G ^DII
P G QQ:$G(^DI(.84,0))']"" K (DTIME,DUZ)
Q G QQ:$G(^DI(.84,0))']"" S DUZ(0)="@" G ^DII
VERSION ;
S VERSION=$P($T(V),";",3),X="VA FileMan V."_VERSION Q
;
QQ ;
W $C(7),!!,"You must run ^DINIT first."
Q
When converted to Java, you get 2929 characters, including white space, and a program that doesn't really do anything more than what the MUMPS program did, but is significantly, (in my mind) harder to read and maintain. And honestly, since I happen to know this program is called from the command line at multiple entry points, the Java program isn't even an accurate mapping of the MUMPS code. It looks like you can't even call the Java code equivalent of DO P^DI . I guess this brings up the main issue I think needs to be addressed by any "language conversion" program, you need to know what the code means to be able to write an accurate translation of it, and why the programmer wrote it to be able to evaluate if the conversion actually worked. (Those who know me well know I could get on this soapbox easily, so I'll avoid distracting your post onto a discussion of code ontologies and knowledge representation)
I really would like to know what you find out, since it gives us in the MUMPS community a better handle on the capabilities of other languages and the various code transformation tools out there.
Best Wishes,
David
PS: here is the Java equivalent of the DI code:
DI.java
// Automatically generated by the JANUS Java Printer
import java.lang.*;
import java.io.*;
import java.util.*;
import tsrilib.*;
// SFISC/GFT-DIRECT ENTRY TO VA FILEMAN ;7/25/94 3:07 PM
// SFISC/GFT-DIRECT ENTRY TO VA FILEMAN ;7/25/94 3:07 PM
public class DI
{
public static String DI()
{
Mumps.Parm[] parms = new Mumps.Parm[0];
return DI(parms);
}
public static String DI(Mumps.Parm[] parms)
{
Mumps.Enter();
return Mumps.Return(DI_());
}
public static String DI_()
{
// Per VHA Directive 10-93-142, this routine should not be modified.
if (Mumps.Bool(Mumps.Not(Mumps.Follows(Mumps.Get(Mumps.VariableRef("^DI", ".84", "0")), ""))))
return QQ_1();
if (Mumps.Bool(Mumps.Not(Mumps.Follows(Mumps.Get(Mumps.VariableRef("^DI", ".84", "0")), ""))))
return QQ_1();
Mumps.ExclusiveKillBegin();
Mumps.ExclusiveKill("DTIME");
Mumps.ExclusiveKill("DUZ");
Mumps.ExclusiveKillEnd();
return DII.DII_();
}
public static String Q()
{
Mumps.Parm[] parms = new Mumps.Parm[0];
return Q(parms);
}
public static String Q(Mumps.Parm[] parms)
{
Mumps.Enter();
return Mumps.Return(Q_());
}
public static String Q_()
{
if (Mumps.Bool(Mumps.Not(Mumps.Follows(Mumps.Get(Mumps.VariableRef("^DI", ".84", "0")), ""))))
return QQ_1();
Mumps.Assign("DUZ", "0", "@");
return DII.DII_();
}
public static String VERSION()
{
Mumps.Parm[] parms = new Mumps.Parm[0];
return VERSION(parms);
}
public static String VERSION(Mumps.Parm[] parms)
{
Mumps.Enter();
return Mumps.Return(VERSION_());
}
public static String VERSION_()//
{
Mumps.Assign("VERSION", Mumps.Piece("V ;;22.0;VA FileMan;;Mar 30, 1999", ";", "3"));
Mumps.Assign("X", "VA FileMan V." + Mumps.Variable("VERSION"));
return "";
}
static String QQ_1()
{
Mumps.Write(Mumps.Char("7"));
Mumps.NewLine();
Mumps.NewLine();
Mumps.Write("You must run ^DINIT first.");
return "";
}
public static String Dispatch(String fun, Mumps.Parm[] parms)
{
if (fun.equals("DI"))
return DI(parms);
if (fun.equals("Q"))
return Q(parms);
if (fun.equals("VERSION"))
return VERSION(parms);
return Mumps.Fail("DI.Dispatch failed for ", fun);
}
public static String GoDispatch(String label)
{
if (label.equals("DI"))
return DI_();
if (label.equals("Q"))
return Q_();
if (label.equals("VERSION"))
return VERSION_();
return Mumps.Fail("DI.GoDispatch failed for ", label);
}
public static String TextDispatch(String label, String offset)
{
return Mumps.Fail("DI.TextDispatch failed for ", label);
}
}