• R/O
  • SSH
  • HTTPS

globalbase: Commit


Commit MetaInfo

Revisão5976 (tree)
Hora2019-08-24 01:44:41
Autorjoshua

Mensagem de Log

os version

Mudança Sumário

Diff

--- modules/tinyState/trunk/src/arch/posix/machine/Darwin/h/ts/c++/tsOSversion.h (nonexistent)
+++ modules/tinyState/trunk/src/arch/posix/machine/Darwin/h/ts/c++/tsOSversion.h (revision 5976)
@@ -0,0 +1,9 @@
1+
2+#ifndef ___tsOSversion_cpp_H___
3+#define ___tsOSversion_cpp_H___
4+
5+class stdOSversion;
6+#include "_ts/c++/tsOSversion_pb.h"
7+
8+#endif
9+
--- modules/tinyState/trunk/src/arch/posix/machine/Darwin/ts/c++/tsOSversion.cpp (nonexistent)
+++ modules/tinyState/trunk/src/arch/posix/machine/Darwin/ts/c++/tsOSversion.cpp (revision 5976)
@@ -0,0 +1,122 @@
1+
2+
3+#include "_ts/c++/tsOSversion_.h"
4+#include "ts/c++/tsSystem.h"
5+#include "ts/c++/tsDevNull.h"
6+#include "ts/c++/stdOSversion.h"
7+#include "ts/c++/tsCallBuffer.h"
8+#include "ts/c++/tsReadLine.h"
9+
10+CLASS_TINYSTATE(ts/c++/tsOSversion,ts/c++/tinyState)
11+
12+
13+#if 0
14+
15+TS_BEGIN_IMPLEMENT
16+
17+#include "ts/c++/tsIOstring.h"
18+
19+class TS_THISCLASS : public TS_BASECLASS {
20+public:
21+ tsOSversion_(
22+ tinyState * parent,
23+ stdOSversion * vers);
24+ void inherit(
25+ tinyState * parent,
26+ stdOSversion * vers);
27+private:
28+protected:
29+ stdOSversion * vers;
30+
31+ tsIOstring * ior;
32+ tsIOstring * ioe;
33+ tsIOstring * iow;
34+};
35+
36+TS_END_IMPLEMENT
37+
38+#endif
39+
40+
41+tsOSversion_::tsOSversion_(
42+ tinyState * _parent,
43+ stdOSversion * vers)
44+ : tinyState_(_parent)
45+{
46+ REF_SET(this->vers,vers);
47+}
48+
49+void
50+tsOSversion_::inherit(
51+ tinyState * _parent,
52+ stdOSversion * vers)
53+{
54+ this->TS_BASECLASS::inherit(_parent);
55+}
56+
57+
58+
59+/*******************************************
60+ INSTANCE FUNCTIONS
61+********************************************/
62+
63+
64+
65+/*******************************************
66+ STATE MACHINE
67+********************************************/
68+
69+
70+TS_STATE(INI_START)
71+{
72+int pid;
73+ NEW tsSystem(NEW tsCallBuffer(ifThis),
74+ &pid,
75+ "#sw_vers",
76+ &ior,&iow,&ioe);
77+ NEW tsDevNull(ifThis,ioe);
78+ return ACT_START;
79+}
80+TS_STATE(ACT_START)
81+{
82+ NEW tsReadLine(ifThis,ior);
83+ return ACT_LINE;
84+}
85+TS_PRIVATE(INTEGER64 v1;)
86+TS_PRIVATE(INTEGER64 v2;)
87+TS_PRIVATE(INTEGER64 v3;)
88+TS_PRIVATE(INTEGER64 v4;)
89+TS_STATE(ACT_LINE)
90+{
91+stdString * line;
92+ R_SET(line)
93+ if ( line->cmp("") == 0 ) {
94+ vers->version_int = v1<<(32+24);
95+ vers->version_int |= v2<<(32+16);
96+ vers->version_int |= v3<<(32+8);
97+ vers->version_int |= v4;
98+ return rDO|FIN_START;
99+ }
100+ if ( line->rx("m",NEW stdRx("^ProductName:[ \t]*([^\n\r]*)")) ) {
101+ REF_SET(vers->name,line->rxVar(1));
102+ }
103+ else if ( line->rx("m",NEW stdRx("^ProductVersion:[ \t]*(([0-9]+)\\.([0-9]+)\\.([0-9]+))")) ) {
104+ REF_SET(vers->version_str,line->rxVar(1));
105+ v1 = line->rxVar(2)->get_int();
106+ v2 = line->rxVar(3)->get_int();
107+ v3 = line->rxVar(4)->get_int();
108+ }
109+ else if ( line->rx("m",NEW stdRx("^BuildVersion:[ \t]*([0-9]+)")) ) {
110+ v4 = line->rxVar(1)->get_int();
111+ }
112+ return rDO|ACT_START;
113+}
114+TS_STATE(FIN_START)
115+{
116+ REF_SET(vers->helper,0);
117+ GCIO(ior,iow,ioe);
118+ REF_SET(ior,0);
119+ REF_SET(iow,0);
120+ REF_SET(ioe,0);
121+ return rDO|FIN_TINYSTATE_START;
122+}
--- modules/tinyState/trunk/src/classes/ts/c++/stdOSversion.cpp (nonexistent)
+++ modules/tinyState/trunk/src/classes/ts/c++/stdOSversion.cpp (revision 5976)
@@ -0,0 +1,32 @@
1+
2+
3+#include "ts/c++/stdOSversion.h"
4+#include "ts/c++/tsOSversion.h"
5+
6+stdOSversion::stdOSversion(tinyState * inp)
7+{
8+ REF_SET(helper,NEW tsOSversion(inp,this));
9+}
10+
11+stdOSversion::~stdOSversion()
12+{
13+ REF_SET(helper,0);
14+}
15+
16+stdOSversion *
17+stdOSversion::get(tinyState * THIS)
18+{
19+stdOSversion * ret;
20+ ret = dynamic_cast<stdOSversion*>(THIS->application->get_global("stdOSversion"));
21+ if ( ret ) {
22+ if ( ret->helper == 0 )
23+ return ret;
24+ ret->helper->listen(THIS,TSE_DESTROY);
25+ return 0;
26+ }
27+ ret = NEW stdOSversion(THIS);
28+ THIS->application->set_global("stdOSversion",ret);
29+ if ( ret->helper == 0 )
30+ return ret;
31+ return 0;
32+}
--- modules/tinyState/trunk/src/h/ts/c++/stdOSversion.h (nonexistent)
+++ modules/tinyState/trunk/src/h/ts/c++/stdOSversion.h (revision 5976)
@@ -0,0 +1,23 @@
1+
2+#ifndef ___stdOSversion_cpp_H___
3+#define ___stdOSversion_cpp_H___
4+
5+#include "ts/c++/stdString.h"
6+#include "ts/c++/tinyState.h"
7+
8+class tsOSversion;
9+class stdOSversion : public stdObject {
10+public:
11+ stdOSversion(tinyState * inp);
12+ ~stdOSversion();
13+ static stdOSversion * get(tinyState * THIS);
14+
15+ stdString * name;
16+ stdString * version_str;
17+ INTEGER64 version_int;
18+ stdString * codeName;
19+
20+ tsOSversion * helper;
21+};
22+
23+#endif
Show on old repository browser