home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 3
/
goldfish_volume_3.bin
/
files
/
dev
/
misc
/
flexcat
/
languages
/
polski.asm
next >
Wrap
Assembly Source File
|
1994-12-07
|
14KB
|
622 lines
From comp.sys.amiga.programmer Wed Nov 30 12:13:37 1994
Path: newsserv.zdv.uni-tuebingen.de!news.belwue.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!pipex!uunet!newsfeed.ACO.net!fuw.edu.pl!news.nask.org.pl!ci.pwr.wroc.pl!pro37
From: pro37@sun1000.ci.pwr.wroc.pl (laboratorium dydaktyczne)
Newsgroups: comp.sys.amiga.programmer
Subject: Re: Making .languages
Date: 24 Nov 1994 10:27:09 GMT
Organization: Technical Univeristy of Wroclaw
Lines: 607
Message-ID: <3b1ppt$8pc@sun1000.ci.pwr.wroc.pl>
References: <39vpt4$obs@trane.uninett.no> <kilroy.03nn@spit.fipnet.fi> <3acr05$aae@holly.csv.warwick.ac.uk>
NNTP-Posting-Host: ci3ux.ci.pwr.wroc.pl
X-Newsreader: TIN [version 1.2 PL2]
Hi everybody!
Yesterday I posted a source for making your own .language. That version
didn't support localized comparison, because I thought no WB .lnaguage has
this feature. But as Rafael D'Halleweyn pointed out, the dansk.language has
them. So here is updated version. I'm afraid you may have some troubles
understanding layout of two conversion tables. My advice is to think a
little, consult AutoDocs or just change the tables and test them. (You can
use ARexx for quick tests). Of course feel free to contact me.
**** Cut here ***************************************************************
; polski.language.asm
; A program to create polski.language (for localized Polish WB)
; By changing the strings to your own you can make any language
; This version supports localized comparison and
; StrConvert() locale.library function
; Resourced from V38 dansk.language by Michael Letowski
;Init macros - copied from exec/initializers.i
INITBYTE MACRO ; &offset,&value
IFLE (\1)-255 ;If offset <=255
DC.B $a0,\1 ;use byte offset
DC.B \2,0
MEXIT ;exit early
ENDC
DC.B $e0,0
DC.W \1
DC.B \2,0
ENDM
INITWORD MACRO ; &offset,&value
IFLE (\1)-255 ;If offset <=255
DC.B $90,\1 ;use byte offset
DC.W \2
MEXIT ;exit early
ENDC
DC.B $d0,0
DC.W \1
DC.W \2
ENDM
INITLONG MACRO ; &offset,&value
IFLE (\1)-255 ;If offset <=255
DC.B $80,\1 ;use byte offset
DC.L \2
MEXIT ;exit early
ENDC
DC.B $c0,0
DC.W \1
DC.L \2
ENDM
;Other constants
LIBF_CHANGED equ $2
LIBF_SUMUSED equ $4
MAXSTRMSG equ $33
NT_LIBRARY equ $9
_LVOFreeMem equ -$D2
LN_SUCC equ $0
lang_SegList equ $22
lang_SysBase equ $26
LN_PRED equ $4
RTF_AUTOINIT equ $80
RTC_MATCHWORD equ $4AFC
LIB_POSSIZE equ $12
LIB_FLAGS equ $E
LIB_NEGSIZE equ $10
LIBB_DELEXP equ $3
LIB_OPENCNT equ $20
;****************************************************************************
; A .language is an Amiga shared library and it has normal library structure
SECTION dansklanguagers000000,CODE
ProgStart
moveq #-1,d0
rts
ResidentTag
dc.w RTC_MATCHWORD
dc.l ResidentTag
dc.l EndResident
dc.b RTF_AUTOINIT
dc.b 38 ;Version
dc.b NT_LIBRARY
dc.b $9C ;Priority
dc.l LanguageName
dc.l LanguageID
dc.l Init
LanguageName
dc.b 'polski.language',0 ;Name of your language
LanguageID
dc.b 'polski 38.3 (23.11.94)',$D,$A,0,0 ;Version string
CNOP 0,4 ;Make sure data is longword aligned
Init dc.l 42 ;Size of library base data space - don't touch
dc.l FuncTable
dc.l DataTable
dc.l InitRoutine
FuncTable dc.w $FFFF
dc.w Open-FuncTable ;$60 ;Open \
dc.w Close-FuncTable ;$6E ;Close | Standard library functions
dc.w Expunge-FuncTable ;$88 ;Expunge | All functions are given as offsets
dc.w Fun1-FuncTable ;$CE ;Fun1 / from FuncTable
dc.w AvailFun-FuncTable ;$D2 ;Capabilities - this returns what functions
;are implemented by Locale
;each bit of return value represents
;one function
dc.w Fun1-FuncTable ;$CE ;Fun1 - I don't know what is it - leave it
;There is usually no need to supply own ConvToLower and ConvToUpper functions
;The ones in locale.library are quite good and can deal with most languages
;You should add your own only in two cases (I think):
;1. Additional (non-standard) letter chars for your language are placed in
$0-$20 or $80 - $C0 area of ASCII code or
;2. The distance between small and capitalized letters is not $20
dc.w Fun1-FuncTable ;$CE ;Fun1 - ConvToLower? - not tested, just suspicion
dc.w Fun1-FuncTable ;$CE ;Fun1 - ConvToUpper? - see above
dc.w GetLocStr-FuncTable ;$55C ;GetLocaleStr - you SHOULD implement this one
;I think that next 11 functions are the IsXXX() (I didn't test it).
;Again, there is usually no need to add this - I didn't have to
;See conditions for ConvertToXXX()
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w Fun1-FuncTable ;$CE
dc.w StrConvert-FuncTable;$1D6 ;StrConvert
dc.w StrnCmp-FuncTable ;$DA ;StrnCmp
dc.w $FFFF
;Library initialization data - don't touch
DataTable INITBYTE 9,$9C ;ln_Pri
INITBYTE 8,NT_LIBRARY ;ln_Type
INITLONG $A,LanguageName ;ln_Name
INITBYTE $E,LIBF_CHANGED | LIBF_SUMUSED;lib_Flags
INITWORD $14,38 ;lib_Version
INITWORD $16,3 ;lib_Revision
INITLONG $18,LanguageID ;lib_IdString
dc.w 0
* DataTable dc.w $A009
* dc.w $9C00
* dc.w $A008
* dc.w $900
* dc.w $800A
* dc.l LanguageName
* dc.w $A00E
* dc.w $600
* dc.w $9014
* dc.w $26
* dc.w $9016
* dc.w 3
* dc.w $8018
* dc.l LanguageID
* dc.w 0
;Standard functions - don't touch
nop
InitRoutine movea.l d0,a1
move.l a0,lang_SegList(a1)
move.l a6,lang_SysBase(a1)
rts
Open addq.w #1,LIB_OPENCNT(a6)
bclr #LIBB_DELEXP,LIB_FLAGS(a6)
move.l a6,d0
rts
Close subq.w #1,LIB_OPENCNT(a6)
btst #LIBB_DELEXP,LIB_FLAGS(a6)
bne.s Expun
moveq #0,d0
rts
Expun tst.w LIB_OPENCNT(a6)
beq.s RemoveLib
moveq #0,d0
rts
Expunge tst.w LIB_OPENCNT(a6)
beq.s RemoveLib
bset #LIBB_DELEXP,LIB_FLAGS(a6)
moveq #0,d0
rts
RemoveLib movem.l d2/a5/a6,-(sp)
movea.l a6,a5
movea.l lang_SysBase(a5),a6
move.l lang_SegList(a5),d2
movea.l a5,a1
movea.l LN_SUCC(a1),a0
movea.l LN_PRED(a1),a1
move.l a0,LN_SUCC(a1)
move.l a1,LN_PRED(a0)
movea.l a5,a1
moveq #0,d0
move.w LIB_NEGSIZE(a5),d0
suba.l d0,a1
add.w LIB_POSSIZE(a5),d0
jsr _LVOFreeMem(a6)
move.l d2,d0
movem.l (sp)+,d2/a5/a6
rts
Fun1 moveq #0,d0
rts
;This returns bit pattern of available functions (not including 4 standard
;library functions)
AvailFun move.l #$18008,d0 ;Available functions
rts
;You don't need to change the code for StrnCmp() and StrConvert() functions
;but you should change two char tables below.
;The tables included in this file are good for Polish language and they work
;(I have tested this)
; StrnCmp(str1,str2,len,type) - see Locale.doc for more information
; a1 = str1
; a2 = str2
; d0 = len
; d1 = type
StrnCmp tst.l d0
bne.s Cmp
rts
Cmp tst.l d1
bne.s Collate
SC_ASCII movem.l d2/a2,-(sp) ;Case insensitive comparison
lea Lower2Upper(pc),a0
moveq #0,d2
ASCII_CompareLoop
move.b (a1)+,d1
move.b (a2)+,d2
move.b 0(a0,d1.w),d1
cmp.b 0(a0,d2.w),d1
bne.s ASCII_Different
tst.b d1
beq.s ASCII_EndOfString
subq.l #1,d0
bne.s ASCII_CompareLoop
movem.l (sp)+,d2/a2
rts
ASCII_EndOfString
moveq #0,d0
movem.l (sp)+,d2/a2
rts
ASCII_Different
bhi.s ASCII_Higher
moveq #-1,d0 ;First string is less than second'
movem.l (sp)+,d2/a2
rts
ASCII_Higher
moveq #1,d0 ;Second string is greater than first
movem.l (sp)+,d2/a2
rts
Collate subq.l #1,d1
bne.s Collate2
SC_COLLATE1
movem.l d2/a2,-(sp)
lea IgnoreAccents(pc),a0
moveq #0,d2
CL1_CompareLoop
move.b (a1)+,d1
move.b (a2)+,d2
move.b 0(a0,d1.w),d1
cmp.b 0(a0,d2.w),d1
bne.s CL1_Different
tst.b d1
beq.s CL1_EndOfString
subq.l #1,d0
bne.s CL1_CompareLoop
movem.l (sp)+,d2/a2
rts
CL1_EndOfString
moveq #0,d0
movem.l (sp)+,d2/a2
rts
CL1_Different
bhi.s CL1_Higher
moveq #-1,d0
movem.l (sp)+,d2/a2
rts
CL1_Higher
moveq #1,d0
movem.l (sp)+,d2/a2
rts
Collate2 subq.l #1,d1
bne.s SC_UNKNOWN
SC_COLLATE2
movem.l d2/d3/a2,-(sp)
lea IgnoreAccents(pc),a0
moveq #0,d2
moveq #0,d3
CL2_Loop move.b (a1)+,d1
beq.s CL2_EndOfString1
move.b (a2)+,d2
cmp.b d2,d1
bne.s CL2_Different1
subq.l #1,d0
bne.s CL2_Loop
movem.l (sp)+,d2/d3/a2
rts
CL2_EndOfString1
cmp.b (a2)+,d1
bne.s CL2_Different1
movem.l (sp)+,d2/d3/a2
moveq #0,d0
rts
CL2_Different1
bhi.s CL2_Higher1
moveq #-1,d3
bra.s CL2_Continue
CL2_Higher1
moveq #1,d3
bra.s CL2_Continue
CL2_CompareLoop
move.b (a1)+,d1
move.b (a2)+,d2
CL2_Continue
move.b 0(a0,d1.w),d1
cmp.b 0(a0,d2.w),d1
bne.s CL2_Different2
tst.b d1
beq.s CL2_EndOfString2
subq.l #1,d0
bne.s CL2_CompareLoop
CL2_EndOfString2
move.l d3,d0
movem.l (sp)+,d2/d3/a2
rts
CL2_Different2
bhi.s CL2_Higher2
moveq #-1,d0
movem.l (sp)+,d2/d3/a2
rts
CL2_Higher2
moveq #1,d0
movem.l (sp)+,d2/d3/a2
rts
SC_UNKNOWN
moveq #0,d0
rts
; StrConvert(string,buffer,bufferSize,type)
; a1 = string
; a2=buffer
; d0 = bufferSize
; d1=type
StrConvert
move.l d0,-(sp)
bne.s Convert
addq.l #4,sp
rts
Convert tst.l d1
bne.s ConvCollate
CONV_ASCII
move.l a2,-(sp)
lea Lower2Upper(pc),a0
bra.s StartConv
ConvCollate
subq.l #1,d1
bne.s ConvCollate2
CONV_COLLATE1
move.l a2,-(sp)
lea IgnoreAccents(pc),a0
bra.s StartConv
ConvLoop move.b (a1)+,d1
beq.s ConvEnd
move.b 0(a0,d1.w),(a2)+
StartConv subq.l #1,d0
bne.s ConvLoop
ConvEnd clr.b (a2)
movea.l (sp)+,a2
move.l (sp)+,d1
sub.l d0,d1
move.l d1,d0
rts
ConvCollate2
subq.l #1,d1
bne.s CONV_UNKNOWN
CONV_COLLATE2
movem.l d2/a2/a3,-(sp)
movea.l a1,a0
ConvLoop2 tst.b (a0)+
bne.s ConvLoop2
suba.l a1,a0
subq.l #1,a0
movea.l a2,a3
adda.l a0,a3
lea IgnoreAccents(pc),a0
bra.s StartConv2
ConvLoop3 move.b (a1)+,d1
beq.s ConvEnd2
move.b 0(a0,d1.w),d2
move.b d2,(a2)+
cmp.b d2,d1
beq.s StartConv2
move.b d1,(a3)+
subq.l #1,d0
beq.s ConvEnd2
StartConv2
subq.l #1,d0
bne.s ConvLoop3
ConvEnd2 clr.b (a3)
movem.l (sp)+,d2/a2/a3
move.l (sp)+,d1
sub.l d0,d1
move.l d1,d0
rts
CONV_UNKNOWN
moveq #0,d0
rts
;IgnoreAccents[256] and Lower2Upper[256] are 2 full ASCII tables
;IgnoreAccents[] describes the relative sorting order for chars
;Accented and not accented chars are considered equal as are
;lower-case and upper-case chars. It looks a bit strange but I didn't
;change it much. I did changes only in last 64 chars.
;I'm afraid that I can't explain it better, since my English is quite limited
;Please see Locale.doc or use your mind or do some tests;
IgnoreAccents
dc.b 0,1,2,3,4,5,6,7,8,9,$A,$B,$C,$D,$E,$F
dc.b $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F
dc.b ' !"#$%&''()*+,-./0123456789:;<=>?'
dc.b '@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`ab'
dc.b 'cABCDEFGHIJKLMNOPQRSTUVWXYZdefgh'
dc.b 'àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
dc.b ' !$$ijkSlmn"opqrstuvwxyz{|}"~',$80,'?'
dc.b 'AAAAA][CEEEEIIINDNOOOOO/\UUUUYPY'
dc.b 'AAAAA][CEEEEIIINDNOOOOO/\UUUUYPY'
;Lower2Upper[] contains accented characters, but lower and upper chars are
;consider equal
Lower2Upper
dc.b 0,1,2,3,4,5,6,7,8,9,$A,$B,$C,$D,$E,$F
dc.b $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F
dc.b ' !"#$%&''()*+,-./0123456789:;<=>?'
dc.b '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_'
dc.b '`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~'
dc.b $80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$8A,$8B,$8C,$8D,$8E,$8F
dc.b $90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9A,$9B,$9C,$9D,$9E,$9F
dc.b ' ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿'
dc.b 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß'
dc.b 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞß'
;Below there are MAXSTRMSG messages for your language
;See <libraries/locale.h> for their description
NullStr dc.w 0
Sunday dc.b 'Niedziela',0
Monday dc.b 'Poniedzialek',0,0
Tuesday dc.b 'Wtorek',0,0
Wednesday dc.b 'Sroda',0
Thursday dc.b 'Czwartek',0,0
Friday dc.b 'Piatek',0,0
Saturday dc.b 'Sobota',0,0
Sun dc.b 'Nie',0
Mon dc.b 'Pon',0
Tue dc.b 'Wto',0
Wed dc.b 'Ôro',0
Thu dc.b 'Czw',0
Fri dc.b 'Pia',0
Sat dc.b 'Sob',0
January dc.b 'Styczen',0
February dc.b 'Luty',0,0
March dc.b 'Marzec',0,0
April dc.b 'Kwiecien',0,0
May dc.b 'Maj',0
June dc.b 'Czerwiec',0,0
July dc.b 'Lipiec',0,0
August dc.b 'Sierpien',0,0
September dc.b 'Wrzesien',0,0
October dc.b 'Pazdziernik',0
November dc.b 'Listopad',0,0
December dc.b 'Grudzien',0,0
Jan dc.b 'Sty',0
Feb dc.b 'Lut',0
Mar dc.b 'Marz',0,0
Apr dc.b 'Kwie',0,0
MayAb dc.b 'Maj',0
Jun dc.b 'Czer',0,0
Jul dc.b 'Lip',0
Aug dc.b 'Sier',0,0
Sep dc.b 'Wrze',0,0
Oct dc.b 'Paz',0
Nov dc.b 'Lis',0
Dec dc.b 'Gru',0
Yes dc.b 'Tak',0
No dc.b 'Nie',0
AM dc.b 'AM',0
PM dc.b 'PM',0
SoftHyphen dc.b '-',0
HardHyphen dc.b '-',0
OpenQuote dc.b '"',0
CloseQuote dc.b '"',0
Yesterday dc.b 'Wczoraj',0
Today dc.b 'Dzisiaj',0
Tomorrow dc.b 'Jutro',0
Future dc.b 'Przyszlosc',0,0
CNOP 0,4
;You should imlement at least this functions
;Please change only strings above and nothing more
GetLocStr cmpi.l #MAXSTRMSG,d0
bcc.s NoEntry
asl.w #2,d0
move.l StringsTable(pc,d0.w),d0
rts
NoEntry moveq #0,d0
rts
; Pointers to strings - don't touch
StringsTable
dc.l NullStr
dc.l Sunday
dc.l Monday
dc.l Tuesday
dc.l Wednesday
dc.l Thursday
dc.l Friday
dc.l Saturday
dc.l Sun
dc.l Mon
dc.l Tue
dc.l Wed
dc.l Thu
dc.l Fri
dc.l Sat
dc.l January
dc.l February
dc.l March
dc.l April
dc.l May
dc.l June
dc.l July
dc.l August
dc.l September
dc.l October
dc.l November
dc.l December
dc.l Jan
dc.l Feb
dc.l Mar
dc.l Apr
dc.l MayAb
dc.l Jun
dc.l Jul
dc.l Aug
dc.l Sep
dc.l Oct
dc.l Nov
dc.l Dec
dc.l Yes
dc.l No
dc.l AM
dc.l PM
dc.l SoftHyphen
dc.l HardHyphen
dc.l OpenQuote
dc.l CloseQuote
dc.l Yesterday
dc.l Today
dc.l Tomorrow
dc.l Future
EndResident
end
**** Cut here ****************************************************************--
+---------------------------------------------------------------------------+
| Michael Letowski |
| Software Engineering Student at Technical University of Wroclaw, Poland |
+-------------------------------------+-------------------------------------+
| pro37@ci3ux.ci.pwr.wroc.pl | ul. Przyjazni 51/17 |
| (Valid until 15 Feb 1995) | 53-030 Wroclaw, Poland |
+-------------------------------------+-------------------------------------+