Ada 95:修改字典程序的输出 [英] Ada 95: Modifying output of dictionary program

查看:131
本文介绍了Ada 95:修改字典程序的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在互联网上发现了William Whitaker的是一个方便的工具。您可以找到已经为您的平台构建的版本。我没有更改代码,但您可以使用各种参数来更改某些内容。甚至还托管了在线。如果你收到了一个Ada编译器,我已经包含了我使用的最后一个 Makefile 。它的抽象有点薄,但它包括编译程序和实用程序的必要步骤,以及构建字典的步骤。

  TARG = words 
ARGS = -O

$(TARG):* .ad [bs]
gnatmake $(TARG)$(ARGS)

全部:$(TARG)
gnatmake makedict $(ARGS)
gnatmake makeinfl $(ARGS)
gnatmake makestem $(ARGS)
gnatmake makeefil $(ARGS)
@echo请使用dicitionary
@echo ./makedict DICTLINE.GEN
@echo ./makestem STEMLIST.GEN
@echo ./makeefil EWDSLIST.GEN
@echo ./makeinfl INFLECTS.GEN

调试:
gnatmake -g $(TARG)

clean:
rm -f * .o * .ali b〜* core

清洁剂:clean
rm -f * .s makedict makeinfl makestem makeefil

cleanest:clean
rm -f $ (TARG)

附录:一种方法是在Ubuntu 10.04上使用gcc 4.4.3, code>生成文件以上。为方便起见,我使用 VirtualBox 来托管linux实例。




$ gcc --version
gcc(Ubuntu 4.4.3-4ubuntu5)4.4.3
版权所有(C)2009免费软件基金会,
这是免费软件;看到复制条件的来源。没有
保修;甚至不适用于适销性或适用于特定目的。

这是一个快速测试,使用我的第二喜欢的段落的标题从 Catulli Carmina

 
$ ./words odi et amo
odi V 6 1 PRES ACTIVE IMP 2 S
odeo,odire,odivi(ii), - V TRANS [EXXCW]以后
od.i V 4 1 PRES ACTIVE IMP 2 S
odio,odire,odivi, - V(4th)TRANS [FXXCF]中世纪
恨;不喜欢;不愿意/不情愿/不利(usu。PREFDEF);
odi N 2 4 GEN S N Early
odium,odi(i)N(2nd)N [XXXAO]
仇恨/仇恨/不喜欢/反感; ium,不受欢迎;厌烦/急躁;
仇恨(表现为/朝向团体),敌意;仇恨/仇恨的对象
od.i V 3 1 PERF ACTIVE IND 1 S
odi,odisse,osus V(3rd)PERFDEF [XXXBX]
hate(PERF form,PRES force),dislike;不愿意/不情愿/不利

et CONJ
et CONJ [XXXAX]
and and even;甚至(et ... et = both ... and);

am.o V 1 1 PRES ACTIVE IND 1 S
amo,amare,amavi,amatus V(1st)[XXXAO]
love,like;陷入爱情;喜欢;有倾向;

附录:运行完毕后,修改问题仍然存在。 grep for Put_Line\(显示629个匹配;大部分在 line_stuff list * 这是我开始的地方,在学习Ada时,有几个很好的教程


I've found this dictionary by William Whitaker on the Internet and I like its parsing capabilities. But the output doesn't fit for me.

The issue (challenge for me):

Given an input form such as "audiam", the program returns the following output (plain text):

audi.am              V      4 1 PRES ACTIVE  SUB 1 S    
audi.am              V      4 1 FUT  ACTIVE  IND 1 S    
audio, audire, audivi, auditus  V (4th)   [XXXAO]  
hear, listen, accept, agree with; obey; harken, pay attention; be able to hear;

But I just want to receive the following text output (same input: audiam):

audiam=audio, audire, audivi, auditus

That is:

InputWord=Dictionary_Forms

So some pieces of information are needless for me.

How can I change the output of this program by modifying the Ada code?

I don't have any Ada knowledge, but I know Delphi/Pascal so it's quite easy to understand the code, isn't it? So the parts causing the text output seem to be the TEXT_IO.PUT(...) statements, right? They're all called in list_package.adb so this is probably the source file to look at.

What has to be changed in particular?

The full Ada 95 source code of this program is available on this page.

I hope some of you are able to understand Ada 95 code. Thank you very much in advance!

My compiling problems:

For use on a windows machine, I downloaded MinGW and tried to compile the source files using "MinGW Shell". But this was my input and the shell's reponse:

Compiling with the latest Cygwin version:

When I compile the program using the latest version of Cygwin, there is no error message:

There is even an .exe file which is created. Its size is 1.6 MB (1,682,616 bytes). But when I open it, it closes right away. What has gone wrong?

解决方案

William Whitaker's Words is a handy tool. You may be able to find a version already built for your platform. I've not changed the code, but you can alter some things using various parameters. It's even hosted online. If you get an Ada compiler, I've included the last Makefile I used. It's a little thin on abstraction, but it includes the essential steps to compile the program and utilities, along with the steps to build the dictionaries.

TARG = words
ARGS = -O

$(TARG): *.ad[bs]
    gnatmake $(TARG) $(ARGS)

all: $(TARG)
    gnatmake makedict $(ARGS)
    gnatmake makeinfl $(ARGS)
    gnatmake makestem $(ARGS)
    gnatmake makeefil $(ARGS)
    @echo Please make the dicitionary
    @echo ./makedict DICTLINE.GEN
    @echo ./makestem STEMLIST.GEN
    @echo ./makeefil EWDSLIST.GEN
    @echo ./makeinfl INFLECTS.GEN

debug:
    gnatmake -g $(TARG)

clean:
    rm -f *.o *.ali b~* core

cleaner: clean
    rm -f *.s makedict makeinfl makestem makeefil

cleanest: cleaner
    rm -f $(TARG)

Addendum: One approach is to use gcc 4.4.3 on Ubuntu 10.04 with the updated Makefile above. For convenience, I used VirtualBox to host the linux instance.

$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here's a quick test using the title of my second favorite passage from Catulli Carmina.

$ ./words odi et amo
odi                  V      6 1 PRES ACTIVE  IMP 2 S    
odeo, odire, odivi(ii), -  V TRANS   [EXXCW]    Later
od.i                 V      4 1 PRES ACTIVE  IMP 2 S    
odio, odire, odivi, -  V (4th) TRANS   [FXXCF]    Medieval
hate; dislike; be disinclined/reluctant/adverse to; (usu. PREFDEF);
odi                  N      2 4 GEN S N                   Early   
odium, odi(i)  N (2nd) N   [XXXAO]  
hate/hatred/dislike/antipathy; odium, unpopularity; boredom/impatience;
hatred (manifested by/towards group), hostility; object of hate/odium;
od.i                 V      3 1 PERF ACTIVE  IND 1 S    
odi, odisse, osus  V (3rd) PERFDEF   [XXXBX]  
hate (PERF form, PRES force), dislike; be disinclined/reluctant/adverse to;

et                   CONJ                               
et  CONJ   [XXXAX]  
and, and even; also, even;  (et ... et = both ... and);

am.o                 V      1 1 PRES ACTIVE  IND 1 S    
amo, amare, amavi, amatus  V (1st)   [XXXAO]  
love, like; fall in love with; be fond of; have a tendency to;

Addendum: Once you've got it running, the problem of modifying it remains. A grep for Put_Line\( shows 629 hits; most are in line_stuff and list*. That's where I'd start. As you are learning Ada, there are several good tutorials here.

这篇关于Ada 95:修改字典程序的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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