Quantcast

how to know the operating system?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to know the operating system?

Marcos Cruz
Is there any way to know what system is SP-Forth running on (Windows or
Linux)?

спасибо
Marcos

--
http://programandala.net

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Spf-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spf-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to know the operating system?

Ruvim Pinka
On Tue, Nov 15, 2011 at 04:27, Marcos Cruz <[hidden email]> wrote:
Is there any way to know what system is SP-Forth running on (Windows or
Linux)?

1. The "ENVIRONMENT?" word.

2. At compile-time:  check for some specific word. For example: lib/include/ansi.f

--
Ruvim


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Spf-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spf-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to know the operating system?

Marcos Cruz
En/Je/On 2011-11-15 18:11, Ruvim Pinka escribió / skribis / wrote :

> /tmp/mutt.html   On Tue, Nov 15, 2011 at 04:27, Marcos Cruz <[1][hidden email]>
>    wrote:
>
>      Is there any way to know what system is SP-Forth running on (Windows or
>      Linux)?
>
>    1. The "ENVIRONMENT?" word.

But what environmental string? I have found lib/ENVIR.SPF. Are those all the
strings avalaible?

>    2. At compile-time:  check for some specific word. For example:
>    [2]lib/include/ansi.f

Thank you. I can check if WINAPI: is defined.

: WINDOWS?  [DEFINED] WINAPI: LITERAL  ;
: LINUX?  WINDOWS? 0=  ;


спасибо
Marcos

--
http://programandala.net

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Spf-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spf-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to know the operating system?

Ruvim Pinka
Hello!

On Thu, Nov 24, 2011 at 22:26, Marcos Cruz <[hidden email]> wrote:
>      Is there any way to know what system is SP-Forth running on (Windows or
>      Linux)?
>
>    1. The "ENVIRONMENT?" word.

But what environmental string? I have found lib/ENVIR.SPF. Are those all the
strings avalaible?


The "OS" variable on Windows, "OSTYPE" — on Linux. See output of the "set" command in shell.


 


>    2. At compile-time:  check for some specific word. For example:
>    [2]lib/include/ansi.f

Thank you. I can check if WINAPI: is defined.

: WINDOWS?  [DEFINED] WINAPI: LITERAL  ;
: LINUX?  WINDOWS? 0=  ;

Yes.

I am researching a more general way. See os-detection.f

This module provides following interface:


OS-API      ( -- d-txt-api    )
OS-BRANCH   ( -- d-txt-branch )
OS-FAMILY   ( -- d-txt-family )
OS-VERSION  ( -- d-version    )
OS-NAME     ( -- d-txt-name   )

IS-OS-BRANCH  ( d-txt-family -- flag )
IS-OS-FAMILY  ( d-txt-family -- flag )

OS-LINUX?    ( -- flag )
OS-WINDOWS?  ( -- flag )


May be it will be in the kernel.

--
Ruvim

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Spf-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spf-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to know the operating system?

Andrey Cherezov
Re: [Spf-dev] how to know the operating system?

Для ядра я бы предпочел числовые варианты всех этих строк, особенно для OS-VERSION. В твоем исходнике это строка:

: OS-VERSION ( -- d-txt-version )
  \ returns varsion as major.minor.build in the PAD
  \ example: 6.0.6002

А на практике требуются сравнения больше-меньше в соответствии с заметками в MSDN "реализовано с такой-то версии винды". Причем некоторые функции появились в W2000, были в XP, но исчезли (или стали макросами) в W2003, т.е. нужны и диапазонные сравнения типа WITHIN, т.е. числа всяк удобнее, чем предлагаемый там EQUAL (я давно использую WinVer из ~ac/lib/win/winver.f).


-------- Исходное сообщение --------
Тема: Re: [Spf-dev] how to know the operating system?
Дата: 2011-11-25 04:16:25
От: [hidden email]

I am researching a more general way. See os-detection.f

This module provides following interface:


OS-API      ( -- d-txt-api    )
OS-BRANCH   ( -- d-txt-branch )
OS-FAMILY   ( -- d-txt-family )
OS-VERSION  ( -- d-version    )
OS-NAME     ( -- d-txt-name   )

IS-OS-BRANCH  ( d-txt-family -- flag )
IS-OS-FAMILY  ( d-txt-family -- flag )

OS-LINUX?    ( -- flag )
OS-WINDOWS?  ( -- flag )


May be it will be in the kernel.

--
Ruvim

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Spf-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spf-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to know the operating system?

Ruvim Pinka
On Fri, Nov 25, 2011 at 06:54, Andrey Cherezov <[hidden email]> wrote:

Для ядра я бы предпочел числовые варианты всех этих строк, особенно для OS-VERSION.


Вообще, в ядре нужен только минимум, — то, что задается на уровне сборки (например, OS-BRANCH и OS-FAMILY).
Остальное можно подключать библиотекой.
Кстати, имя "OS-BRANCH" не очень нравится, что-нибудь лучше есть?

Если делать числовые коды, то нужен и набор слов — числовых констант. А какой плюс в числовых вариантах этих значений?


В твоем исходнике это строка:

: OS-VERSION ( -- d-txt-version )
  \ returns varsion as major.minor.build in the PAD
  \ example: 6.0.6002

А на практике требуются сравнения больше-меньше в соответствии с заметками в MSDN "реализовано с такой-то версии винды". Причем некоторые функции появились в W2000, были в XP, но исчезли (или стали макросами) в W2003, т.е. нужны и диапазонные сравнения типа WITHIN, т.е. числа всяк удобнее, чем предлагаемый там EQUAL

Да, согласен.

OS-VERSION-MAJOR ( -- u-major )
OS-VERSION-MINOR ( -- u-minor )

пойдет?  Просто, я не уверен, что для других ОС  вресия будет так же прямо отображаться на эти два числа.

Комбинировать в одно число (как в winver.f) я бы не стал. Например, коэффициент 10 вполне может исчерпаться.


(я давно использую WinVer из ~ac/lib/win/winver.f).

winver.f у меня там тоже подключен.



--
Ruvim

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Spf-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spf-dev
Loading...