From ecd290adea4ae70dcd0a5af36f1ab2cb392acdae Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Wed, 2 Mar 2022 09:03:20 -0800 Subject: [PATCH] Jest test for webamp-modern-2 --- packages/ani-cursor/package.json | 12 +- packages/webamp-modern-2/jest.config.js | 17 + packages/webamp-modern-2/jest.setup.js | 2 + packages/webamp-modern-2/package.json | 11 +- .../src/maki/__tests__/MockSystem.ts | 64 + .../TestBedSkin/images/main-bg-shadow.png | Bin 0 -> 18772 bytes .../fixtures/TestBedSkin/scripts/assertions.m | 38 + .../TestBedSkin/scripts/assertions.maki | Bin 0 -> 2683 bytes .../fixtures/TestBedSkin/scripts/lib/std.mi | 2777 +++++++++++++++++ .../__tests__/fixtures/TestBedSkin/skin.xml | 35 + .../src/maki/__tests__/makiFixture.test.ts | 70 + packages/webamp-modern-2/tsconfig.json | 7 + yarn.lock | 2026 +++++++++--- 13 files changed, 4614 insertions(+), 445 deletions(-) create mode 100644 packages/webamp-modern-2/jest.config.js create mode 100644 packages/webamp-modern-2/jest.setup.js create mode 100644 packages/webamp-modern-2/src/maki/__tests__/MockSystem.ts create mode 100644 packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/images/main-bg-shadow.png create mode 100755 packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.m create mode 100644 packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.maki create mode 100644 packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/scripts/lib/std.mi create mode 100644 packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/skin.xml create mode 100644 packages/webamp-modern-2/src/maki/__tests__/makiFixture.test.ts create mode 100644 packages/webamp-modern-2/tsconfig.json diff --git a/packages/ani-cursor/package.json b/packages/ani-cursor/package.json index e4db3e48..6e5b4e5f 100644 --- a/packages/ani-cursor/package.json +++ b/packages/ani-cursor/package.json @@ -4,7 +4,10 @@ "description": "Render .ani cursors as CSS animations in the browser", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": ["dist/", "src/**/*.ts"], + "files": [ + "dist/", + "src/**/*.ts" + ], "author": "Jordan Eldredge ", "license": "MIT", "repository": { @@ -27,7 +30,7 @@ "@babel/preset-typescript": "^7.12.7", "@types/jest": "^26.0.18", "babel-jest": "^26.6.3", - "jest": "^26.6.3", + "jest": "^27.5.1", "typescript": "^4.1.2" }, "dependencies": { @@ -35,6 +38,9 @@ "riff-file": "^1.0.3" }, "jest": { - "modulePathIgnorePatterns": ["dist"] + "modulePathIgnorePatterns": [ + "dist" + ], + "testEnvironment": "jsdom" } } diff --git a/packages/webamp-modern-2/jest.config.js b/packages/webamp-modern-2/jest.config.js new file mode 100644 index 00000000..564f35b2 --- /dev/null +++ b/packages/webamp-modern-2/jest.config.js @@ -0,0 +1,17 @@ +module.exports = { + ...require("@snowpack/app-scripts-react/jest.config.js")(), + testMatch: ["**/__tests__/**/?(*.)+(spec|test).[jt]s?(x)"], + transform: { + "^.+\\.(js|jsx|ts|tsx)$": "ts-jest", + //"^.+\\.svg$": "/jest/svgTransform.js", + // "^.+\\.css$": "/jest/cssTransform.js", + }, + // testEnvironment: "jsdom", + globals: { + "ts-jest": { + diagnostics: { + warnOnly: true, + }, + }, + }, +}; diff --git a/packages/webamp-modern-2/jest.setup.js b/packages/webamp-modern-2/jest.setup.js new file mode 100644 index 00000000..dcb3d6c5 --- /dev/null +++ b/packages/webamp-modern-2/jest.setup.js @@ -0,0 +1,2 @@ +// This has to exist for some reason, or Jest complains... +// I think it's something about the Snowpack config that we are using. diff --git a/packages/webamp-modern-2/package.json b/packages/webamp-modern-2/package.json index e7a4ed43..17076b49 100644 --- a/packages/webamp-modern-2/package.json +++ b/packages/webamp-modern-2/package.json @@ -10,19 +10,24 @@ "build-lint": "tsup tools/eslint-rules/proper-maki-types.ts -d tools/eslint-rules/dist --no-splitting --minify" }, "devDependencies": { + "@babel/preset-typescript": "^7.16.7", + "@snowpack/app-scripts-react": "^2.0.1", "@types/eslint": "^7.2.14", "@types/estree": "^0.0.50", "@typescript-eslint/eslint-plugin": "^4.28.2", "@typescript-eslint/parser": "^4.28.2", "eslint": "^7.30.0", "eslint-plugin-rulesdir": "^0.2.0", + "jest": "^27.5.1", "snowpack": "^3.5.5", - "typescript": "^4.3.5", - "tsup": "^4.12.5" + "ts-jest": "^27.1.3", + "tsup": "^4.12.5", + "typescript": "^4.3.5" }, "prettier": {}, "dependencies": { "@rgrove/parse-xml": "^3.0.0", - "jszip": "^3.6.0" + "jszip": "^3.6.0", + "ts-jest": "^27.1.3" } } diff --git a/packages/webamp-modern-2/src/maki/__tests__/MockSystem.ts b/packages/webamp-modern-2/src/maki/__tests__/MockSystem.ts new file mode 100644 index 00000000..d3550426 --- /dev/null +++ b/packages/webamp-modern-2/src/maki/__tests__/MockSystem.ts @@ -0,0 +1,64 @@ +import { getClass } from "../objects"; + +export function classResolver(guid: string): any { + switch (guid) { + case "d6f50f6449b793fa66baf193983eaeef": + return MockSystem; + case "45be95e5419120725fbb5c93fd17f1f9": + return MockGroup; + case "6129fec14d51dab7ca016591db701b0c": + return MockGuiList; + } + throw new Error( + `Unresolvable class "${getClass(guid).name}" (guid: ${guid})` + ); +} + +export class MockSystem { + group = new MockGroup(); + getruntimeversion() { + return 5.666; + } + messagebox( + message: string, + msgtitle: string, + flag: number, + notanymore_id: string + ) { + return 1; + } + getscriptgroup() { + return this.group; + } + + // Not part of the original Maki code, but added to access test data. + getAssertions(): string[][] { + return this.group.list.items; + } +} + +class MockGroup { + list = new MockGuiList(); + getobject(objectId: string) { + if (objectId !== "results") { + throw new Error( + "In this test, we only expect this to be called to get the list." + ); + } + return this.list; + } +} + +class MockGuiList { + items: string[][] = []; + additem(status: string) { + this.items.push([status]); + return 1; + } + getlastaddeditempos() { + return this.items.length - 1; + } + setsubitem(i: number, j: number, value: string) { + this.items[i][j] = value; + } +} diff --git a/packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/images/main-bg-shadow.png b/packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/images/main-bg-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..9e89f420721fe4a858d35473cbcc41901e2ab225 GIT binary patch literal 18772 zcmZ^~bwE^o_b)m#Gz^V|)Bw^T-8DmZBi-FdgT&CFbW08*f(l4U3DPMbAWDZY(k+cJ zXMCRDx#xZFJ@*fo@9aH$?-if#s=Zc{uC@vx{zH5K06?gws;H0tYy$v*)VSE_6`;Vl z9Q_~9N7d9103aa$`v(LR6j7rOVmiaLU;sdUYS^t_7WzBHUR7TU00?CT0N^nIz%>f} zxdQ+M@B;w5HUNNRJ^(=FooPLw3;?K(swu(@gBSKQWr%wD!OC({OtySd1jhJO2T;Bk zMX!wP{y|=>z)jgNU70N^S1^gK-#!lqsr!^B(?IVRCXq>RgmA$sL{Ti#0|8EfbMx0Y z8D0?qe(&va+b7&6Lhz5n_`5o2T4K2?W^VlpYdI^1PTk&`qaHOcQhmR?A%ho&N&%^3 z%K&b6NZWzhvs(5fXl!)0KW) zh8f8lCO;D#tUR6*KB~3O((49wPNB#eB5O8^zY_kC8 zzD&oE#Dvnyparm%x%-isJ6Si@p>*oZrS}b@u(rI}wZ6+m70(IhO5&R^y-?T){AJKG zE)&l;iIzPgisrCmJq?F<+0kuZ{eh8#OI6kC@1953#@7qMt!?w@$gW-p$aY>5OY4{u zM|Pv2D0x`|Nbbf^8ZCe~35W+jZt-4)U*Yt93Ob_x9CnQfcCdMM|C`+8IV#S@?hmoo zEAW;RK7XGOTu_>IZF9WPW?^zNeI0!H>r0;Ps{b{yrg7K(AG@o&Ut)bNN7mFQA3;LArZEx~71E<6IKoBq9=M@@%c; zCnAqGEEsljqw_X2IERSGqC_@aQqw^6kxcY7HOEPGK`*}?3Pr4DU+qy12K@nn zLGpjVbo=QG=eL(f2>GkBj0`=F^jn%lSVgy(i+n=PF3Ofw0tz_%!hi!MdEWD9xqE8- zS)HGEZ4Z5Z%JXJN0p*lNKG$IlT%L+BKK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VNC+xVl(d{qL+ZC6Wkm zlh5fg!g4Ajz3s_v7j(5Id7qL^r=!XKJd@1r@1}rl>*FBF9xiGN>PC_{5#3bu{>y(? z8~A!HWHOt}<&yXYcGj9o!G>hAV|$o50zoP-Rnecd#N=cA$sm_F7le2LT(@riu98!5+6jDq08@Xx@7|Wq62g@(1)$bN$dat z#DZ)X>@G-7!s2kPTpo8q~so&4hy3pmYivz6KqaLM#9XAeQ&<-~V~?Oi5z+G1C+=?r8p>ogKn7v7R(ZZ>jG(p- zXlX6%wEw|=``9QLz6l(8j{|4`1k^kMT>=5R`Vw?T{)-nc_8}!^Y!}wT0YCt;05x0y z(%XSK#S3;95a={f*knfh9YrEe=|;2pV4bzyP_d_9Ya*1!9o=S5TsdT~-SaK%mqs0K_~% zEC|G+P%I1;=LKR;Xo-(}A?PR=1#~Ukk=ov%(i(I?;%8_g2PN#+43OKHKR^>dNdDJ< z=*%QQ0I@(d{Y26T+V%rmH1HQH#|jl2P2{6sAQSmtXtU%SQc3<1nr?qU)9N4e<_bUn zu^_c=zCrmcXbGGXDd97YCiGD-KnWa{$bUf#o0I?uxM844$ zR=R(MCURD!Cd()o1p@*8Ar;8qp=t9AG=YDCmgK*XI-c;+6@UO@LDKvK$*|u@xrGgy z$g$pAJ_<$wol5h6NNE#Rn#1r9D8?woK>#3tSkMH2AQ=QJ$yrA`o}*xpbv$7S9fr|| z4^bwA00M{wNi%Yeff>RAZHteV;-g?NmFBPsAXviw%YZo<1P1^C#E6B>gqEn0+v=kw z`6w93lAHl8G5 fXA}%~01#jRhd4sDQU1l300000NkvXXu0mjfrGo+~ literal 0 HcmV?d00001 diff --git a/packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.m b/packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.m new file mode 100755 index 00000000..d47e48b4 --- /dev/null +++ b/packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.m @@ -0,0 +1,38 @@ +#include "lib/std.mi" +// To compile in VM: +// From within this directoy (so the compiled .maki file ends up here) +// & '..\..\..\..\..\..\..\webamp-modern\resources\maki_compiler\v1.2.0 (Winamp 5.66)\mc.exe' .\assertions.m + +Global GuiList resultsList; +Function Boolean assert(Boolean isTrue, String code, String description); + +// This is our special test function we wraps messageBox for now. +// In the future this should be a function that renders a green/red box in a +// skin. +Boolean assert(Boolean isTrue, String code, String description) { + String response; + if(isTrue) { + resultsList.addItem("SUCCESS"); + } else { + resultsList.addItem("FAILURE"); + } + + Int i = resultsList.getLastAddedItemPos(); + resultsList.setSubItem(i, 1, code); + resultsList.setSubItem(i, 2, description); +} + +System.onScriptLoaded() +{ + Group systemGroup; + systemGroup = System.getScriptGroup(); + if(systemGroup == null) { + System.messageBox("Null", "Null", 0, "Null"); + } + resultsList = systemGroup.getObject("results"); + + assert(1 + 1 == 2, "1 + 1 == 2", "Summing two integers results in an integer"); + assert(3 / 2 == 1.5, "3 / 2 == 1.5", "Division of two integers results in a float"); + assert(1 + 1.5 == 2.5, "1 + 1.5 == 2.5", "Summing an integer and a float results in a float"); + assert(1.5 + 1 == 2.5, "1.5 + 1 == 2.5", "Summing a float and an integer results in a float"); +} \ No newline at end of file diff --git a/packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.maki b/packages/webamp-modern-2/src/maki/__tests__/fixtures/TestBedSkin/scripts/assertions.maki new file mode 100644 index 0000000000000000000000000000000000000000..cb99489d72af3ec2f1266b7f8ac4a2ca77780290 GIT binary patch literal 2683 zcmcIl3s4hR6x|J^LJR~yD3}%&KOpGD0wr2nB>^IYKp=$AAXSNE!Bp~Lli>e@RdlM9 zGN52_DxIl-)LPUk1r*Uzs#R;pDNe1l9n^|e9e*f71^VvWM8vUnrqgC--+TAmbI-f) z?Y*11Q4Wsd34-uLPp+I+ZE{h?6kn-26cqBHODlMIp|7M~UUIK7>(0J8XYQOf+6lZ28pfq<_hjsJJ<`Wj}P+#OJT%-4Bq--|K6-s_o9dD6ea&Nf&*6q(5xI z;YAB(7D@{L$jgsu5H4*li~qiEsi$&B%8%v2r*iyUs1r3eRRM~|weuBi^J8;oHF_0( z96cwxA*0Yc;+s~k2(u^q?Um9lsOCtLAVv|{v?bAMu;}!33eA{xMgzbj z0ah>38I&454S)*(35+gJW1-~+3qX8;l2BZHR-|S*OEN!C;t_hsT{_d^Z#y-b@Q)-p_9dE0Vz}k_jE}&+AwR4J z2kiu~&`!4BEA|DRhho6|Cu{Q0T|Hc}=J6x*$M-p8763_p~e(*Aee*bm{ID^Ae z8TK8ugt5TOG+8Dk`Df{0f>}^Cr5dpYVS3?30kO``&-*|Vu2Z)67$YO7w4 z+KsX-HBz<~G@~qW1Oh0H!46MEd_ECO&7guHK2Q`g2_e&nNL`)|z7Lc!>+e;ltQ@1p zG6e;=vMGo{a1x>rUxWodO=D;~w6m7duyMl@Vj=i*L{dn`ejZWC)ZtRLSgiB(6fcmn zmmd#>cOs()l@bZ1gdK3t#OoXufMVgZOXv%p%B=xS_-jEzc_5xM0O%n|Cm5h8SREKW zph^)5wqjA(#|}WKlpKjhJ}Uz>eu5h)V>PxjhXS8hhx9nuO+vlklt?Hd5-O2|nv-}y z;vAbCDEq(%lJIeGL*p~CID4o!5*#Loa^%>kQ0*_IBAg(>Yr;7Xj~a_`2X`380S!zy zyn=5V3HNNmx5XKax5X$FwhbjG01Z$RSi1`!*K@+a z;NU2nCALW+(9lDe;01s>MgVehqtJ+*Bs3TMX7LIJ`zdiYI0*XAgs&XQK%bG&d~A}i zrG$i}oIG!!95^Jj5eeNzQZRrkg7iV7ljliH@C6uphgATVgq(~C)tCT "Audio") + + @ret The registered family for given extension. + @param ext The extension in question. +*/ +extern String System.getExtFamily(String ext); + +extern String system.getDecoderName(string playitem); + +/** + playFile() + + Play the requested file. Path and filename are required + with proper extension (example: playFile("c:\music\mp3\file.mp3"); ). + It also works with URL's (example: playFile("http://myshoutcast.com:8000"); ). + + @param playitem The path and filename to play. +*/ +extern System.playFile(String playitem); + +extern Int System.getAlbumArt(String playitem); //Requires 5.5 // Will return 1 if an album art has been downloaded, otherwise 0 + +/** + downloadMedia() + + Hookable. Downloads a file from url and saves it as destination_filename. + If destinationPath is "" it will be saved in CD Ripping dir (=getDownloadPath()). + + @param url the file to be downloaded + @param destinationPath the path you want to store the file + @param wantAddToML set true if you wnt to add the file to ML database + @param notifyDownloadsList set true in order to list the download in Object +*/ +extern System.downloadMedia(String url, String destinationPath, boolean wantAddToML, boolean notifyDownloadsList); // Requires 5.54 +deprecated extern System.downloadURL(String url, String destination_filename, String progress_dialog_title); //Requires 5.5 // destination_filename is just a dummy parameter as well as progress_dialog_title - use download() instead + +extern System.onDownloadFinished(String url, boolean success, String filename); // Requires 5.53 +extern String System.getDownloadPath(); // Requires 5.53 // returns the CD Ripping Directory +extern System.setDownloadPath(String new_path); // Requires 5.53 // Sets the CD Ripping Directory + +/** + enqueueFile() + + Enqueque the requested file. Path and filename are required + with proper extension (example: playFile("c:\music\mp3\file.mp3"); ). + It also works with URL's (example: playFile("http://myshoutcast.com:8000"); ). + + @param playitem The path and filename to play. +*/ +extern System.enqueueFile(String playitem); //Requires 5.5 + +/** + getLeftVuMeter() + + Get the value of the left vu meter. + Range is from 0 to 255. Linear. + + @ret The value of the left vu meter. +*/ +extern Int System.getLeftVuMeter(); + +/** + getRightVuMeter() + + Get the value of the right vu meter. + Range is from 0 to 255. Linear. + + @ret The value of the left vu meter. +*/ +extern Int System.getRightVuMeter(); + +/** + getVolume() + + Get the current volume. Range is from 0 to 255. + + @ret The current volume. +*/ +extern Int System.getVolume(); + +/** + setVolume() + + Set the volume to the desired value. + Range is from 0 to 255. + + @param vol The desired volume value. +*/ +extern System.setVolume(Int vol); + +/** + play() + + Trigger the play event. +*/ +extern System.play(); + +/** + stop() + + Trigger the stop event. +*/ +extern System.stop(); + +/** + pause() + + Trigger the pause event. +*/ +extern System.pause(); + +/** + next() + + Trigger the next event. +*/ +extern System.next(); + +/** + previous() + + Trigger the previous event. +*/ +extern System.previous(); + +/** + eject() + + Trigger the eject event. +*/ +extern System.eject(); + +/** + seekTo() + + Seek to the desired position in the track. Range is from + 0 to SONG LENGTH (in milliseconds). +*/ +extern System.seekTo(Int pos); + +/** + getPosition() + + Get the current position in the track currently playing, + in milliseconds. + + @ret The current position in the track. +*/ +extern Int System.getPosition(); + +/** + setEqBand() + + Sets the requested equalizer band to the specified value. + The bands are numbered from 0 (60Hz) to 9 (16kHz) and + each range from -127 to +127. + + @param band The EQ band to set. + @param value The desired value for the specified band. +*/ +extern System.setEqBand(int band, Int value); + +/** + setEqPreamp() + + Set the equalizer pre-amp to the desired value. + Range is from -127 to +127 (0 means no preamp). + + @param value The desired value for the pre-amp. +*/ +extern System.setEqPreamp(Int value); + +/** + Set the equalizer to the desired state. On or off. + 0 is off, 1 is on. + + @param onoff The desired state for the eq. +*/ +extern System.setEq(Int onoff); + +/** + getEqBand() + + Get the value of an equalizer band. The bands + are numbered from 0 (60Hz) to 9 (16kHz). The return + value range is from -127 to +127. + + @ret The value of the band. + @param band The eq band number you want to get. +*/ +extern Int System.getEqBand(int band); + +/** + getEqPreamp() + + Get the equalizer preamp value. The value range is + from -127 to +127 (0 means no preamp). + + @ret The preamp's current value. +*/ +extern int System.getEqPreamp(); + +/** + getEq() + + Get the equalizer state. 0 for off, 1 for on. + Remember to compare return value to true and false. + + @ret The EQ's state. +*/ +extern int System.getEq(); + +/** + getMousePosX() + + This returns the X position of the mouse in the screen, + using the screen coordinate system. + + @ret The mouse's current X pos. +*/ +extern int System.getMousePosX(); + +/** + getMousePosY() + + This returns the Y position of the mouse in the screen, + using the screen coordinate system. + + @ret The mouse's current Y pos. +*/ +extern int System.getMousePosY(); + +/** + integerToString() + + Get the string representation of an integer. + + @ret The string equivalent of the integer. + @param value The integer to change into a string. +*/ +extern String System.integerToString(Int value); + +/** + StringToInteger() + + Get the integer representation of a string. + + @ret The integer equivalent of the string. + @param str The string to change into an integer. +*/ +extern Int System.StringToInteger(String str); + +/** + floatToString() + + Get the string representation of a floating point number. + + @ret The string representation of the float number. + @param value The float to convert. + @param ndigits Number of digits after the decimal point you want. +*/ +extern String System.floatToString(float value, int ndigits); + +/** + stringToFloat() + + Get the floating point representation of a string. + + @ret The float representation of the string. + @param str The string to convert. +*/ +extern Float System.stringToFloat(String str); + +/** + integerToLongTime() + + Convert a time in seconds to a HH:MM:SS value. + + @ret The string representation of the time (HH:MM:SS). + @param value Timestamp to use. +*/ +extern String System.integerToLongTime(Int value); + +/** + integerToTime() + + Convert a time in seconds to a MM:SS value. + + @ret The string representation of the time (MM:SS). + @param value Timestamp to use. +*/ +extern String System.integerToTime(Int value); + +extern String System.dateToTime(Int datetime); // prints the time from a date with the same format as integerToTime +extern String System.dateToLongTime(Int datetime); // prints the time from a date with the same format as integerToLongTime +extern String System.formatDate(Int datetime); // formats the date according to the locales - short date format +extern String System.formatLongDate(Int datetime); // formats the date according to the locales - long date format +extern Int System.getDateYear(Int datetime); // returns the datetime's year since 1900 +extern Int System.getDateMonth(Int datetime); // returns the datetime's month (0-11) +extern Int System.getDateDay(Int datetime); // returns the datetime's day of the month (1-31) +extern Int System.getDateDow(Int datetime); // returns the datetime's day of the week (0-6) +extern Int System.getDateDoy(Int datetime); // returns the datetime's day of the year (0-365) +extern Int System.getDateHour(Int datetime); // returns the datetime's hour (0-23) +extern Int System.getDateMin(Int datetime); // returns the datetime's minutes (0-59) +extern Int System.getDateSec(Int datetime); // returns the datetime's seconds (0-59) +extern Int System.getDateDst(Int datetime); // returns the datetime's daylight savings flag +extern Int System.getDate(); // returns the datetime, use with the above functions + +/** + strmid() + + Get a substring from a string. + + @ret The substring. + @param str The string. + @param start The start position. + @param len The length of the string to extract, from start position. +*/ +extern String System.strmid(String str, Int start, Int len); + +/** + strleft() + + Get a substring from a string, starting from the left. + + @ret The substring. + @param str The string. + @param nchars The length of the string to extract, from the left. +*/ +extern String System.strleft(string str, int nchars); + +/** + strright() + + Get a substring from a string, starting from the right. Since + the start point is the right of the string (or the end). It will + extract the string starting from the END going towards the BEGINNING. + + @ret The substring. + @param str The string. + @param nchars The length of the string to extract, from the right. +*/ +extern string System.strright(string str, int nchars); + +/** + strsearch() + + Search a string for any occurance of substring. If the substring was + found in the string, it will return the position of the substring in + the string searched. If the substring is not found, the return value + is -1. + + @ret Position at which the substring was found. + @param str The string to search in. + @param substr The substring to find. +*/ +extern int System.strsearch(string str, string substr); + +/** + strlen() + + Returns the length of the string. + + @ret The length of the string. + @param str The string. +*/ +extern int System.strlen(string str); + +/** + strupper() + + Convert a string to all uppercase. + + @ret The uppercase string. + @param str The string to uppercase. +*/ +extern string System.strupper(string str); + +/** + strlower() + + Convert a string to all lowercase. + + @ret The lowercase string. + @param str The string to lowercase. +*/ +extern string System.strlower(string str); + +/** + urlEncode() + + URL Encode a string. Characters that are NOT encoded + are: All letters, All digits, underscore (_), dash (-) and + period (.). + + @ret The URL encoded string. + @param url The string to URL encode. +*/ +extern string System.urlEncode(string url); + +extern string System.urlDecode(string url); // Requires 5.54 + +/** + parseATF() + + Pass a string through the ATF parser + + @ret The ATF encoded string. + @param topass The string to ATF encode. +*/ +//extern string System.parseATF(string topass); // To be done + +/** + removePath() + + Remove the path from a full filename. (example: + c:\music\mp3\test.mp3 -> test.mp3) + Also works on URLs. + + @ret The filename with the path removed. + @param str The fullpath of a file. +*/ +extern string System.removePath(string str); + +/** + getPath() + + Gets the path from a full filename. (example: + c:\music\mp3\test.mp3 -> c:\music\mp3) + Also works on URLs. + + @ret The path with the filename removed. + @param str The fullpath of a file. +*/ +extern string System.getPath(string str); + +/** + getExtension() + + Gets the extension from a filename. (example: + c:\music\mp3\test.mp3 -> mp3) + Also works on URLs. + + @ret The extension of the filename. + @param str The fullpath of a file. +*/ +extern string System.getExtension(string str); + +/** + getToken() + + Retreive a token from a list of tokens seperated by separator. + The index starts at 0, not 1, so be careful. + Here's a short example: + getToken("1,2,3,4,5", ",", 3); + Would return, 3. If the token you ask for doesn't exist, an + empty string is returned. + + @ret The token requested. + @param str The tokenenized string. + @param separator The separator to use. + @param tokennum The token to retreive. +*/ +extern string System.getToken(string str, string separator, int tokennum); + +/** + sin() + + Takes an angle in radians and returns the ratio of two sides of a right triangle. + The ratio is the length of the side opposite the angle divided by the length + of the hypotenuse. The result range is from -1 to 1. + + Converting from degrees to radians can be done by multiplying degrees by PI/180. + + @ret The sine value of the angle. + @param value The angle for which you want to know the sine value. +*/ +extern double System.sin(double value); + +/** + cos() + + Takes an angle in radians and returns the ratio of the two sides of a right triangle. + The ratio is the length of the side adjacent to the angle divided by the length of the + hypotenuse. The result is range is from -1 to 1. + + @ret The cosine value of the angle. + @param value The angle for which you want to know the cosine value. +*/ +extern double System.cos(double value); + +/** + tan() + + Takes an angle in radians and returns the ratio between two sides of a right triangle. + The ratio is sin(x) divided by cos(x). + + @ret The tangent value of the angle. + @param value The angle for which you want to know the tangent value. +*/ +extern double System.tan(double value); + +/** + asin() + + Takes a sine value ranging from -1 to 1 and returns the angle in radians. + The return value ranges from -PI/2 to +PI/2. + + @ret The angle in radians. + @param value The sine value for which you want to know the angle. +*/ +extern double System.asin(double value); + +/** + acos() + + Takes a cosine value ranging from -1 to 1 and returns the angle in radians. + The return value ranges from -PI/2 to +PI/2. + + @ret The angle in radians. + @param value The cosine value for which you want to know the angle. +*/ +extern double System.acos(double value); + +/** + atan() + + Takes an angle in radians and returns the ration between two sides of a right triangle. + The ratio is cos(x) divided by sin(x). + + @ret The arc tangent value of the angle. +*/ +extern double System.atan(double value); + +/** + atan2() + + @ret The arctangent of y/x. +*/ +extern double System.atan2(double y, double x); + + +/** + pow() + + Elevate a number to the N'th power. + + @ret The number + @param value The number you want to elevate to the N power. + @param pvalue The power to which you want to elevate the number. +*/ +extern double System.pow(double value, double pvalue); + +/** + sqr() + + Get the square of a number. + + @ret The number, squared. + @param value The number for which you want the square value. +*/ +extern double System.sqr(double value); + +extern double System.log10(double value); +extern double System.ln(double value); + +/** + sqrt() + + Get the square root of a number. + + @ret The square root of the number. + @param value The number for which you want the square root value. +*/ +extern double System.sqrt(double value); + +/** + random() + + Get a randomely generated number. The random number will not + be bigger than the max value indicated. Smallest value is 0. + + @ret The random number. + @param max The maximum value of the random number to return. +*/ +extern int System.random(int max); + +/** + setPrivateString() + + Create a private config entry for your script, of String type. + + @param section The section for the entry. + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPrivateString(string section, string item, string value); + +/** + setPrivateInt() + + Create a private config entry for your script, of Int type. + + @param section The section for the entry. + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPrivateInt(string section, string item, int value); + +/** + getPrivateString() + + Read a private config entry of String type. Returns + the specified default value if the section and item isn't + found. + + @ret The value of the config entry. + @param section The section from which to read the entry. + @param item The name of the item to read. + @param defvalue The default value to return if no item is found. +*/ +extern String System.getPrivateString(String section, String item, String defvalue); + +/** + getPrivateInt() + + Read a private config entry of Integer type. Returns + the specified default value if the section and item isn't + found. + + @ret The value of the config entry. + @param section The section from which to read the entry. + @param item The name of the item to read. + @param defvalue The defautl value to return if no item is found. +*/ +extern Int System.getPrivateInt(String section, String item, Int defvalue); + +/** + setPublicString() + + Create a public config entry for your script, of String type. + + @param item The item name for the entry. + @param value The value of the entry. +*/ +extern System.setPublicString(String item, String value); + +/** + setPublicInt() + + Create a public config entry for your script, of Int type. + + @param item The item name of the entry. + @param value The value of the entry. +*/ +extern System.setPublicInt(String item, Int value); + +/** + getPublicString() + + Read a public config entry of String type. Returns + the specified default value if the item isn't found. + + @ret The value of the config entry. + @param item The item name to read. + @param defvalue The default value to return if no item is found. +*/ +extern String System.getPublicString(String item, String defvalue); + +/** + getPublicInt() + + Read a public config entry of Integer type. Returns + the specified default value if the item isn't found. + + @ret The value of the config entry. + @param item The item name to read. + @param defvalue The default value to return if no item is found. +*/ +extern Int System.getPublicInt(String item, Int defvalue); + +/** + getParam() + + Get the parameters with which the script is called. + This is the 'param="..."' attribute in the