Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Arbitrary Precision Logical Spreadsheet DLL
Message
De
09/06/2020 19:18:58
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Titre:
Arbitrary Precision Logical Spreadsheet DLL
Divers
Thread ID:
01674808
Message ID:
01674808
Vues:
158
J'aime (1)
I have a favorite text editor I use called The SemWare Editor. A friend of mine named Sammy Mitchell wrote it back in the late 80s (Used to be QEdit in DOS, then later TSE in DOS and Windows).

I wrote an arbitrary precision spreadsheet for use within his text editor as the SAL macro language he created only has integer support. By referencing the external DLL, I was able to create a logical spreadsheet allowing for basic calculations and computations to be created, and then have the data extracted.

It's still in beta, but if you're interested in testing it please download the May 25, 2020 Bignums Macro Download at this link: http://www.libsf.org/misc/sem32/index.html

And here is the VFP code to make it work. You only need the bignums.dll file. You can discard all the rest. But if you're interested, all the source code is there too at the link above. Download May.25.2020 Bignums source code.

Steps:

1) Put the bignums.dll file into a folder.
2) Create test.prg with this source code.
3) DO test.prg
4) It may still have bugs. If you find any, please email me (rick.c.hodgin at gmail).
* Register the bignums.dll functions

* Note:  By default, it will use a 26 x 50, which gives you A1..Z50 for logical cell access
DECLARE INTEGER bgn_Initialize IN bignums.dll INTEGER nRows, INTEGER nCols

* Run this after blocks of calculations, it will free up memory
DECLARE INTEGER bgn_garbageCollect IN bignums.dll

* Specify how many significant digits you want to see in your base-10 answer
* It defaults to 50
DECLARE INTEGER bgn_SetPrecision IN bignums.dll INTEGER nDigits

* These functions use a cell reference
DECLARE INTEGER bgn_SetValue IN bignums.dll STRING cCell, STRING cValue
DECLARE INTEGER bgn_GetValue IN bignums.dll STRING cCell, INTEGER nWidth, INTEGER nDecimals, STRING@ output
DECLARE INTEGER bgn_SetFormula IN bignums.dll STRING cCell, STRING cFormula
DECLARE INTEGER bgn_GetFormula IN bignums.dll STRING cCell, STRING@ cFormula

* These functions use a row,col reference
DECLARE INTEGER bgn_SetValue2 IN bignums.dll INTEGER nRow, INTEGER nCol, STRING cValue
DECLARE INTEGER bgn_GetValue2 IN bignums.dll INTEGER nRow, INTEGER nCol, INTEGER nWidth, INTEGER nDecimals, STRING@ output
DECLARE INTEGER bgn_SetFormula2 IN bignums.dll INTEGER nRow, INTEGER nCol, STRING cFormula
DECLARE INTEGER bgn_GetFormula2 IN bignums.dll INTEGER nRow, INTEGER nCol, STRING@ output

* Creates a .CSV file that can be loaded into a real spreadsheet
DECLARE INTEGER bgn_SaveAsCsv IN bignums.dll STRING cFullPathname, INTEGER nWidth, INTEGER nDecimals, STRING cOptionalRange

* These should only be called at startup
*bgn_Initialize(100, 50)
*bgn_SetPrecision(32)

* This should only be called as needed.  It never needs to be called, but it will free up unused memory:
*bgn_garbageCollect()

CLEAR

? "Cell:"
bgn_SetValue("A1", "50.00")

lcResult = SPACE(32)
bgn_GetValue("A1", 32, 5, @lcResult)
? "A1 = " + ALLTRIM(lcResult)

bgn_SetFormula("B1", "A1+5")

lcResult = SPACE(32)
bgn_GetFormula("B1", @lcResult)
? "B1 = " + CHR(34) + ALLTRIM(lcResult) + CHR(34)
lcResult = SPACE(32)
bgn_GetValue("B1", 32, 5, @lcResult)
? "B1 = " + ALLTRIM(lcResult)

? ""
? "(row,col):"
bgn_SetValue2(10, 10, "50.00")

lcResult = SPACE(32)
bgn_GetValue2(10, 10, 32, 5, @lcResult)
? "(10, 10) = " + ALLTRIM(lcResult)

bgn_SetFormula2(11, 10, "A1+5")

lcResult = SPACE(32)
bgn_GetFormula2(11, 10, @lcResult)
? "(11, 10) = " + CHR(34) + ALLTRIM(lcResult) + CHR(34)
lcResult = SPACE(32)
bgn_GetValue2(11, 10, 32, 5, @lcResult)
? "(11, 10) = " + ALLTRIM(lcResult)

bgn_SaveAsCsv("test.csv", 32, 4, "")
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform