-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
##base _LocaleBase | ||
##bias 30 | ||
##public | ||
*--- functions in V38 or higher (Release 2.1) --- | ||
##private | ||
localePrivate1()() | ||
##public | ||
CloseCatalog(catalog)(a0) | ||
CloseLocale(locale)(a0) | ||
ConvToLower(locale,character)(a0,d0) | ||
ConvToUpper(locale,character)(a0,d0) | ||
FormatDate(locale,fmtTemplate,date,putCharFunc)(a0/a1/a2/a3) | ||
FormatString(locale,fmtTemplate,dataStream,putCharFunc)(a0/a1/a2/a3) | ||
GetCatalogStr(catalog,stringNum,defaultString)(a0,d0/a1) | ||
GetLocaleStr(locale,stringNum)(a0,d0) | ||
IsAlNum(locale,character)(a0,d0) | ||
IsAlpha(locale,character)(a0,d0) | ||
IsCntrl(locale,character)(a0,d0) | ||
IsDigit(locale,character)(a0,d0) | ||
IsGraph(locale,character)(a0,d0) | ||
IsLower(locale,character)(a0,d0) | ||
IsPrint(locale,character)(a0,d0) | ||
IsPunct(locale,character)(a0,d0) | ||
IsSpace(locale,character)(a0,d0) | ||
IsUpper(locale,character)(a0,d0) | ||
IsXDigit(locale,character)(a0,d0) | ||
OpenCatalogA(locale,name,tags)(a0/a1/a2) | ||
OpenLocale(name)(a0) | ||
ParseDate(locale,date,fmtTemplate,getCharFunc)(a0/a1/a2/a3) | ||
##private | ||
localePrivate2()() | ||
##public | ||
StrConvert(locale,string,buffer,bufferSize,type)(a0/a1/a2,d0/d1) | ||
StrnCmp(locale,string1,string2,length,type)(a0/a1/a2,d0/d1) | ||
##private | ||
localePrivate3()() | ||
localePrivate4()() | ||
localePrivate5()() | ||
localePrivate6()() | ||
localePrivate7()() | ||
localePrivate8()() | ||
##end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
from amitools.vamos.machine.regs import * | ||
from amitools.vamos.libcore import LibImpl | ||
from amitools.vamos.lib.util.TagList import * | ||
from amitools.vamos.lib.util.AmiDate import * | ||
from amitools.vamos.log import * | ||
|
||
import string | ||
|
||
class LocaleLibrary(LibImpl): | ||
def OpenLocale(self, ctx): | ||
name = ctx.cpu.r_reg(REG_A0) | ||
# dummy | ||
return 0 | ||
|
||
def CloseLocale(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
# dummy - accept all | ||
|
||
def IsUpper(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
return chr(character) in string.uppercase | ||
|
||
def IsLower(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
return chr(character) in string.lowercase | ||
|
||
def IsDigit(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
return chr(character) in string.digits | ||
|
||
def IsPrint(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
return chr(character) in string.printable | ||
|
||
def IsCntrl(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
#maybe not ok... | ||
return character < 32 and not chr(character) in string.printable | ||
|
||
def IsXDigit(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
return chr(character) in string.hexdigits | ||
|
||
def IsSpace(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
return chr(character) in string.whitespace | ||
|
||
def IsPunct(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
return chr(character) in string.punctuation | ||
|
||
def IsGraph(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
return chr(character) in string.printable and not chr(character) in string.whitespace | ||
|
||
""" | ||
def CloseCatalog(self, ctx): | ||
catalog = ctx.cpu.r_reg(REG_A0) | ||
print "not implemented: CloseCatalog" | ||
def ConvToLower(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
print "not implemented: ConvToLower" | ||
def ConvToUpper(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
character = ctx.cpu.r_reg(REG_D0) | ||
print "not implemented: ConvToUpper" | ||
def FormatDate(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
fmtTemplate = ctx.cpu.r_reg(REG_A1) | ||
date = ctx.cpu.r_reg(REG_A2) | ||
putCharFunc = ctx.cpu.r_reg(REG_A3) | ||
print "not implemented: FormatDate" | ||
def FormatString(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
fmtTemplate = ctx.cpu.r_reg(REG_A1) | ||
dataStream = ctx.cpu.r_reg(REG_A2) | ||
putCharFunc = ctx.cpu.r_reg(REG_A3) | ||
print "not implemented: FormatString" | ||
def GetCatalogStr(self, ctx): | ||
catalog = ctx.cpu.r_reg(REG_A0) | ||
defaultString = ctx.cpu.r_reg(REG_A1) | ||
stringNum = ctx.cpu.r_reg(REG_D0) | ||
print "not implemented: GetCatalogStr" | ||
def GetLocaleStr(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
stringNum = ctx.cpu.r_reg(REG_D0) | ||
print "not implemented: GetLocaleStr" | ||
def OpenCatalogA(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
name = ctx.cpu.r_reg(REG_A1) | ||
tagList = ctx.cpu.r_reg(REG_A2) | ||
print "not implemented: OpenCatalogA" | ||
def ParseDate(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
date = ctx.cpu.r_reg(REG_A1) | ||
fmtTemplate = ctx.cpu.r_reg(REG_A2) | ||
putCharFunc = ctx.cpu.r_reg(REG_A3) | ||
print "not implemented: ParseDate" | ||
def StrConvert(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
string = ctx.cpu.r_reg(REG_A1) | ||
buffer = ctx.cpu.r_reg(REG_A2) | ||
bufferSize = ctx.cpu.r_reg(REG_D0) | ||
type = ctx.cpu.r_reg(REG_D1) | ||
print "not implemented: StrConvert" | ||
def StrnCmp(self, ctx): | ||
locale = ctx.cpu.r_reg(REG_A0) | ||
string1 = ctx.cpu.r_reg(REG_A1) | ||
string2 = ctx.cpu.r_reg(REG_A2) | ||
length = ctx.cpu.r_reg(REG_D0) | ||
type = ctx.cpu.r_reg(REG_D1) | ||
print "not implemented: StrnCmp" | ||
""" |