如何在OpenEdge Progress-4GL中启动外部过程 [英] How to launch an external procedure in OpenEdge Progress-4GL

查看:73
本文介绍了如何在OpenEdge Progress-4GL中启动外部过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在学习OpenEdge Progress-4GL时,我偶然发现了运行外部程序的过程,并且我只是阅读了以下代码行,描述了如何执行此操作:

While learning about OpenEdge Progress-4GL, I stumbled upon running external procedures, and I just read following line of code, describing how to do this:

RUN p-exprc2.p.

对于具有C/C ++,Java和Delphi编程经验的人来说,这绝对没有意义:在这些语言中,有一堆过程(函数)存在于外部文件中,需要将其导入,例如:

For a person with programming experience in C/C++, Java and Delp this makes absolutely no sense: in those languages there is a bunch of procedures (functions), present in external files, which need to be imported, something like:

filename "file_with_external_functions.<extension>"
===================================================
int f1 (...){
  return ...;
}

int f2 (...){
  return ...;
}

filename "general_file_using_the_mentioned_functions.<extension>"
=================================================================
#import file_with_external_functions.<extension>;
...
int calculate_f1_result = f1(...);
int calculate_f2_result = f2(...);

因此,换句话说:外部过程(函数)表示您列出了过程(函数)列表,将它们全部放入,并在需要时导入该文件并在需要时启动过程(函数)它.

So, in other words: external procedures (functions) mean that you make a list of procedures (functions), you put all of them and in case needed, you import that file and launch the procedure (function) when you need it.

In Progress 4GL,看来您正在启动整个文件!
尽管在C/C ++,Java,Delphi中根本没有意义,但我相信这意味着Progress过程文件(扩展名"* .p")仅应包含一个过程,然后文件名就是该过程.

In Progress 4GL, it seems you are launching the entire file!
Although this makes no sense at all in C/C++, Java, Delp I believe this means that Progress procedure files (extension "*.p") only should contain one procedure, and the name of the file is then the name of that procedure.

那是正确的吗?在这种情况下, PERSISTENT 关键字的含义是什么?

Is that correct and in that case, what's the sense of the PERSISTENT keyword?

在此先感谢
多米尼克

Thanks in advance
Dominique

推荐答案

RUN语句有很多选项:

There are a lot of options to the RUN statement: https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvref%2Frun-statement.html%23

但是,在简单的情况下,如果您只是:

But, in the simple case, if you just:

RUN name.p.

您正在调用一个过程.它可以是内部的,超级",持久的".或外部.也可以是OS DLL.

You are invoking a procedure. It might be internal, "super", "persistent" or external. It could also be an OS DLL.

解释器将首先搜索具有该名称的内部过程.因此:

The interpreter will first search for an internal procedure with that name. Thus:

procedure test.p.
  message "yuck".
end.

run test.p.

将运行内部过程"test.p".本地"网络内部过程是在与RUN语句相同的编译单元内定义的.(用".p"命名内部过程是一种可恶的做法,请不要这样做.我只是在演示它,以阐明RUN如何解析名称.)

Will run the internal procedure "test.p". A "local" internal procedure is defined inside the same compilation unit as the RUN statement. (Naming an internal procedure with ".p" is an abomination, don't do it. I'm just showing it to clarify how RUN resolves names.)

如果未找到本地内部过程,则4gl解释器将查找具有该名称的SESSION SUPER过程.通过首先运行PERSISTENT过程来实例化它们.

If a local internal procedure is not found then the 4gl interpreter will look for a SESSION SUPER procedure with that name. These are instantiated by first running a PERSISTENT procedure.

如果未找到匹配的内部过程或SUPER过程,则4gl会在PROPATH中搜索以寻找匹配的过程(它将首先寻找以.r结尾的编译版本),如果找到,则将其运行.

If no matching internal procedure or SUPER procedure is found the 4gl will search the PROPATH looking for a matching procedure (it will first look for a compiled version ending with .r) and, if found, will RUN that.

有更多使用句柄和IN关键字运行过程的复杂方法.您还可以传递参数并在运行时即时编译".论点.上面的文档涵盖了所有内容.我的答案只是覆盖一个简单的RUN名称.

There are more complex ways to run procedures using handles and the IN keyword. You can also pass parameters and "compile on the fly" arguments. The documentation above gets into all of that. My answer is just covering a simple RUN name.p.

这篇关于如何在OpenEdge Progress-4GL中启动外部过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆