# Updated plugins

#### vefatica

I uploaded updated plugins to ftp://lucky.syr.edu/4plugins. 4UTILS and SYSUTILS
have definitely changed (some details below) and CONUTILS may have changed
(though I couldn't remember what changed). Some of the changes are ...

4UTILS:

Added @SUM and @AVG, both requiring spaces as separators and setting the new
variable _N.

Added @EXECW ... a wrapper for "START /WAIT" that returns %?

Added @FACT[N] and @STIRLING[N] ... factorial and Stirling's approx

Moved @PSET to SYSUTILS

SYSUTILS:

Added @PSET (was in 4UTILS) @PSET manipulates the environment of another
process; may be of some use with _PPID (parent process)

Replaced _MOUSE with _MOUSEX and _MOUSEY (mouse pointer position)

Added @PID[<case-insensitive module name substring>] ... returns PID of first
matching process ... could change it to wildcard or regex, I suppose.

Added @CWD[<pid>] ... current working directory of process <pid> ... probably
not much use for it in TCC, but maybe there are some TCMD tricks one could do
with it ... will not work (on processes you don't own maybe more) without
sufficient privileges

Changed @PROCTIME to allow module_name_substrings (first match) as well as PIDs
... internally just like @PROCTIME[%@PID[string]...]

I removed the consideration of the environment variable SE_DEBUG_NAME. All
functions that read/write the memory space of other processes (@PSET, @PID,
@PROCTIME) now automatically (try to) enable (and later disable) the SeDebugName
privilege.

#### Jay Sage

Vince,

It looks as though @SUM processes only the first two arguments. See below.

-- Jay

TCMD9>echo %@sum[1 2 3]
3

TCMD9>echo %@sum[30 20 10]
50

TCMD9>echo %@sum[1 2 3 4 5]
3

TCMD9>uhelp @sum
@SUM[n1 n2 ...] = sum of n1, n2, ...

#### vefatica

On Tue, 24 Jun 2008 22:34:24 -0500, you wrote:

>TCMD9>echo %@sum[1 2 3]
>3
>
>TCMD9>echo %@sum[30 20 10]
>50
>
>TCMD9>echo %@sum[1 2 3 4 5]
>3

Hmmm! It looks differently here. Have you got a UDF called @SUM?

v:\> echo %@sum[2 3 4]
9

v:\> echo %@sum[1 2 3]
6

v:\> echo %@sum[30 20 10]
60

v:\> echo %@sum[1 2 3 4 5]
15

#### Jay Sage

> Have you got a UDF called @SUM?

Bingo!

Now I have to decide what to do. My function supports the syntax

@sum[arg1,arg2]

which yours does not. On the other hand, my function works only with
exactly two arguments. The question is, will dropping mine break some of
my BTM files. The answer is, probably not. When I use functions in batch
files, I usually define them there just to be sure (possibly copying the
definition from my global definition file).

-- Jay

#### vefatica

On Tue, 24 Jun 2008 22:52:57 -0500, you wrote:

>Now I have to decide what to do. My function supports the syntax
>
> @sum[arg1,arg2]

I don't recall why mine doesn't. Don't some folk use the comma as the decimal
separator?

#### Jay Sage

> I don't recall why mine doesn't. Don't some folk use
> the comma as the decimal separator?

Good point. I am conditioned by programming languages and mathematics to
always put commas between arguments, but I see that a space is just as
good. I should probably adopt that practice for all JPSoft programming.

-- Jay

#### Steve Fabian

Jay Sage wrote:
|| I don't recall why mine doesn't. Don't some folk use
|| the comma as the decimal separator?
|
| Good point. I am conditioned by programming languages and mathematics
| to always put commas between arguments, but I see that a space is
| just as good. I should probably adopt that practice for all JPSoft
| programming.

In mathematics, one would normally use a comma followed by space, which in
the cultures which use a "decimal comma" distinguishes a number with decimal
fractional part from a sequence of two function arguments. I.e. f(1,75) is a
function of a single parameter with value 175/100, while f(1, 75) is a
function of two integer parameters 1 and 75.

Unfortunately some functions in JPsoft which expect a 2nd or later string
parameter this results in problems, because leading space(s) may be part of
the string parameter. I can see no solution to this issue due to the 25-year
old basic syntax of the language.
--
Steve

#### vefatica

On Wed, 25 Jun 2008 09:10:55 -0500, you wrote:

>|| I don't recall why mine doesn't. Don't some folk use
>|| the comma as the decimal separator?
>|
>| Good point. I am conditioned by programming languages and mathematics
>| to always put commas between arguments, but I see that a space is
>| just as good. I should probably adopt that practice for all JPSoft
>| programming.
>
>In mathematics, one would normally use a comma followed by space, which in
>the cultures which use a "decimal comma" distinguishes a number with decimal
>fractional part from a sequence of two function arguments. I.e. f(1,75) is a
>function of a single parameter with value 175/100, while f(1, 75) is a
>function of two integer parameters 1 and 75.

It would be nice if a plugin could determine the numeric separators in use.

Though the help says

You can display the value of all SETDOS

SETDOS doesn't display the numeric separators.

Are there any ideas on how a plugin can determine the numeric separators? Will
%@numeric[1,2,3] be 0 if the comma is the decimal separator?

#### rconn

vefatica wrote:

> Are there any ideas on how a plugin can determine the numeric
> separators? Will
> %@numeric[1,2,3] be 0 if the comma is the decimal separator?

It's a Windows setting - see GetLocaleInfo. If the user is overriding
the Windows setting with a local TCC setting (unlikely) you can retrieve
the value with @OPTION[DecimalChar].

Rex Conn
JP Software

#### Jim Cook

> Are there any ideas on how a plugin can determine the numeric separators?
> Will
> %@numeric[1,2,3] be 0 if the comma is the decimal separator?

Doesn't this do the job?
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, cpDecimalSep, iBufferSize);

--
2008 Fridays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Saturday.
Measure wealth by the things you have for which you would not take money.

#### vefatica

On Wed, 25 Jun 2008 11:17:14 -0500, you wrote:

>It's a Windows setting - see GetLocaleInfo. If the user is overriding
>the Windows setting with a local TCC setting (unlikely) you can retrieve
>the value with @OPTION[DecimalChar].

So, theoretically, I might have to do two tests. I've got this right now (not
thoroughly tested):

BOOL CommaIsDecimal ( VOID )
{
WCHAR szTest[32] = L"%@numeric[1,2,3]";
ExpandVariables(szTest, 1);
return ( szTest[0] == L'0' );
}

INT WINAPI f_SUM ( WCHAR *psz )
{
static WCHAR *seps = CommaIsDecimal() ? L" " : L" ,";

#### rconn

vefatica wrote:

> Quote:
> >It's a Windows setting - see GetLocaleInfo. If the user is overriding
> >the Windows setting with a local TCC setting (unlikely) you can retrieve
> >the value with @OPTION[DecimalChar].
>
> So, theoretically, I might have to do two tests. I've got this right now
> (not
> thoroughly tested):
>
> BOOL CommaIsDecimal ( VOID )
> {
> WCHAR szTest[32] = L"%@numeric[1,2,3]";
> ExpandVariables(szTest, 1);
> return ( szTest[0] == L'0' );
> }
>
> INT WINAPI f_SUM ( WCHAR *psz )
> {
> static WCHAR *seps = CommaIsDecimal() ? L" " : L" ,";

Theoretically. Though "DecimalChar" is really a holdover from 4DOS; I
don't know of any reason for somebody to be overriding their Windows
settings, as it would make TCMD / TCC incompatible with everything else
on their system.

Rex Conn
JP Software

#### David Marcus

In mathematics, one would normally use a comma followed by space

In typeset mathematics, there may be a little bit of space after a comma, but there certainly isn't a whole space. (I just tried it with TeX.)

#### Steve Fabian

David Marcus wrote:
| ---Quote (Originally by Steve Fábián)---
| In mathematics, one would normally use a comma followed by space
| ---End Quote---
| In typeset mathematics, there may be a little bit of space after a
| comma, but there certainly isn't a whole space. (I just tried it with
| TeX.)

Was TeX set to use the comma as the decimal separator in your test?

Was the source text before introducing typesetting controls "f(1,2)" without
spaces, or "f(1, 2)" with a space after the comma?
--
Steve

#### David Marcus

Was TeX set to use the comma as the decimal separator in your test?

No, I was using the default (U.S.) settings. TeX and LaTeX don't have a simple way of setting the comma as the decimal separator. See

It appears TeX is adding some space after the comma in math, but I'm not sure exactly how much.

Was the source text before introducing typesetting controls "f(1,2)" without
spaces, or "f(1, 2)" with a space after the comma?

TeX handles the spacing automatically. You get the same result whether you include a space after the comma or not.

#### Jay Sage

> In mathematics, one would normally use a comma
> followed by space

Not in the United States (as far as I know, at least). According to what
I learned, f(1,75) was a function with two arguments. We would never
write f(1, 75). And it was years and years before I ever learned that
some people use a comma as a decimal 'point'.

And when doing mathematics, we would never write the number 1234 as
1,234. That is, we used only a decimal separator and never a thousands
separator. The latter was only for text.

-- Jay

#### Steve Fabian

Jay Sage wrote:
|| In mathematics, one would normally use a comma
|| followed by space
|
| Not in the United States (as far as I know, at least). According to
| what
| I learned, f(1,75) was a function with two arguments. We would never
| write f(1, 75). And it was years and years before I ever learned that
| some people use a comma as a decimal 'point'.
|
| And when doing mathematics, we would never write the number 1234 as
| 1,234. That is, we used only a decimal separator and never a thousands
| separator. The latter was only for text.

... and in the US hand-written numeral 1 and capital I are also identical.
It had fouled me up before I learned the nomenclature for semiconductors.
Regardless, we did not discuss "written" material, we referred to typeset
material. Both European and US publications I just examined are typeset so
that a comma separating elements in a list, whether it be a series, or the
argument list of a function, is much closer to the element if follows thant
to the element it preceeds, just as in ordinary English text (and text in
all languages using Latin-based or Greek-based languages, including
Cyrillic). I also observed that arithmetic operators are typeset with extra
spacing on both sides.

BTW, I didn't know until my junior year in college that some people use
"decimal point". In most of Europe the decimal separator is the comma, and
JPsoft products are used in Europe, hence they must accomodate it.
--
Steve

#### David Marcus

Jay Sage wrote:
|| In mathematics, one would normally use a comma
|| followed by space
|
| Not in the United States (as far as I know, at least). According to
| what
| I learned, f(1,75) was a function with two arguments. We would never
| write f(1, 75). And it was years and years before I ever learned that
| some people use a comma as a decimal 'point'.
|
| And when doing mathematics, we would never write the number 1234 as
| 1,234. That is, we used only a decimal separator and never a thousands
| separator. The latter was only for text.

... and in the US hand-written numeral 1 and capital I are also identical.
It had fouled me up before I learned the nomenclature for semiconductors.
Regardless, we did not discuss "written" material, we referred to typeset
material.

I believe Jay was referring to typeset when he said "written". He was contrasting math with non-math ("text"). If a number occurs in math, we don't use commas to separate thousands.

Both European and US publications I just examined are typeset so
that a comma separating elements in a list, whether it be a series, or the
argument list of a function, is much closer to the element if follows thant
to the element it preceeds, just as in ordinary English text (and text in
all languages using Latin-based or Greek-based languages, including
Cyrillic).

There is very little extra space after a comma in math. Here is some output from LaTeX:

http://www.davidmarcus.com/comma.pdf

The first line is math, the second is text in an italic font with one space after the comma.

#### Jay Sage

Steve Fabian wrote:

> in the US hand-written numeral 1 and capital I are
> also identical.

Not to mention the confusion between the numeral 1 and the lowercase
letter 'L'. I work at MIT Lincoln Laboratory where the domain is
ll.mit.edu (that's LL.MIT.EDU). Some people seeing the lowercase version
would think it was 11.mit.edu (that's numerals one, one). Fortunately,
the folks at MIT were smart and set up the subdomain 11.MIT.EDU to point
to LL.MIT.EDU.

It's also not to mention the confusion in the U.S. between the numerals
'1' and '7'.

> Both European and US publications I just examined are
> typeset so that a comma separating elements in a
> list, whether it be a series, or the argument list of
> a function, is much closer to the element if follows
> thant to the element it preceeds

I'm sure you're right, but I never noticed -- and I suspect that I'm not
alone.

> I didn't know until my junior year in college that
> some people use "decimal point".

It may have been even later than college for me to be aware that the way
I learned was not the way it was done everywhere in the world. When I
lived in Japan, I learned that they don't think in blocks of 10^3
(thousands, millions, etc.) but in blocks of 10^4 (man).

I hope it was clear that I was not arguing for the U.S. system or
against the other, or suggesting that JPSoft products should not support
both (all?) systems. I was mainly trying to point out how provincial we
are here in the U.S. Of course, it would have been good if we had all
adopted the same system of writing numbers, just as we did with units of
measure :-).

-- Jay

#### Steve Fabian

David Marcus wrote:
| There is very little extra space after a comma in math. Here is some
| output from LaTeX:
|
| http://www.davidmarcus.com/comma.pdf
|
| The first line is math, the second is text in an italic font with one
| space after the comma.

Notice, however, the spacing around the comma is almost symmetric in the
math, and there is also space surrounding the parentheses, intended to make
each element more distinguishable. No such spacing in the text version. Only
the text version is supported in command processors.
--
Steve

#### Steve Fabian

David Marcus wrote:
| ---Quote (Originally by Steve Fábián)---
| Was TeX set to use the comma as the decimal separator in your test?
| ---End Quote---
| No, I was using the default (U.S.) settings. TeX and LaTeX don't have
| a simple way of setting the comma as the decimal separator. See
|

That's too bad, it is apparently strictly for the few countries using
decimal point.

| It appears TeX is adding some space after the comma in math, but I'm
| not sure exactly how much.

... and also around other syntactic element, e.g., parentheses. See my other
response.
|
| ---Quote---
| Was the source text before introducing typesetting controls "f(1,2)"
| without
| spaces, or "f(1, 2)" with a space after the comma?
| ---End Quote---
| TeX handles the spacing automatically. You get the same result
| whether you include a space after the comma or not.

Lazy man's dream, expert's frustration. If the program knows what you want
better than you, it should be the author.
--
Steve

#### Steve Fabian

Jay Sage wrote:
| Steve Fabian wrote:
|
|| in the US hand-written numeral 1 and capital I are
|| also identical.
|
| Not to mention the confusion between the numeral 1 and the lowercase
| letter 'L'. I work at MIT Lincoln Laboratory where the domain is
| ll.mit.edu (that's LL.MIT.EDU). Some people seeing the lowercase
| version would think it was 11.mit.edu (that's numerals one, one).
| Fortunately,
| the folks at MIT were smart and set up the subdomain 11.MIT.EDU to
| point
| to LL.MIT.EDU.
|
| It's also not to mention the confusion in the U.S. between the
| numerals '1' and '7'.

Add digit 0 and capital O, digit 2 and capital Z. That's why most military
abbreviations don't include certain letters (I, O, Z).
| ...
| I hope it was clear that I was not arguing for the U.S. system or
| against the other, or suggesting that JPSoft products should not
| support both (all?) systems. I was mainly trying to point out how
| provincial we
| are here in the U.S. Of course, it would have been good if we had all
| adopted the same system of writing numbers, just as we did with units
| of measure :-).

When the US usage adopted some of the SI prefixes, it promptly started
incorrect capitalization, and often incorrectly dropping the unit symbol
after the prefix. Yet how simple the SI scheme is:
- prefixes are capital for M (mega) or larger, lower case for all others
- unit symbol capitalization is independent of prefix capitalization; if
unit is named after a person, first letter of symbol is capitalized; all
else is lower case.
- division symbol is / or you use negative exponent for units in the
denominator

Of course, even though it has been over 40 years since the SI symbol usage
had a US standard, schools still teach "abbreviations", e.g. "sec" (SI
symbol: s). And it has been 145 years or so since ALL US measures are based
on the metric system.

As to identical writing of unit names, there are two English spellings each
of the units of length and volume: meter v. metre, liter v. litre. And in
German the fully spelled out name of any unit is capitalized to conform to
the basic spelling rule of the language: nouns are capitalized.

I think this is enough OT.
--
Steve

#### David Marcus

| TeX handles the spacing automatically. You get the same result
| whether you include a space after the comma or not.

Lazy man's dream, expert's frustration. If the program knows what you want
better than you, it should be the author.

You're joking, right? TeX knows more about typesetting math than 99% of mathematicians (and 99.9% of other people who need to write math). For those times when you need to give it some help, you can tell it to add or remove some space. It is a markup/programming language. An analogous situation is the way multiple spaces are handled in HTML.

Anyway, the point was that the statement that there is a space after commas in math is incorrect. When typeset, there is a little bit of space, but if you are not typesetting, then "f(x,y)" is correct, not "f(x, y)".

Replies
4
Views
4K
Replies
2
Views
284
Replies
0
Views
945
Replies
0
Views
1K
Replies
0
Views
1K
Replies
6
Views
2K
Replies
1
Views
2K
Replies
0
Views
3K
Replies
4
Views
1K
Replies
1
Views
972
Replies
16
Views
2K
Replies
3
Views
1K
Replies
6
Views
2K
Replies
11
Views
7K
Replies
4
Views
3K
Replies
2
Views
3K
Replies
4
Views
4K