Merge Samba3 and Samba4 together
[samba.git] / source4 / lib / appweb / ejs-2.0 / ejs / system / ejsSystem.c
1 /*
2  *      @file   ejsSystem.c
3  *      @brief  System class for the EJS Object Model
4  */
5 /********************************** Copyright *********************************/
6 /*
7  *      Copyright (c) Mbedthis Software LLC, 2005-2006. All Rights Reserved.
8  */
9 /********************************** Includes **********************************/
10
11 #include        "ejs.h"
12
13 /******************************************************************************/
14 /************************************ Methods *********************************/
15 /******************************************************************************/
16 #if UNUSED
17 /*
18  *      function int random()
19  */
20
21 static int randomProc(Ejs *ep, EjsVar *thisObj, int argc, EjsVar **argv)
22 {
23         ejsTrace(ep, "random()\n");
24         return 0;
25 }
26
27 /******************************************************************************/
28 /*
29  *      function void yield()
30  */
31
32 static int yieldProc(Ejs *ep, EjsVar *thisObj, int argc, EjsVar **argv)
33 {
34         ejsTrace(ep, "yield()\n");
35         return 0;
36 }
37
38 /******************************************************************************/
39 /*
40  *      function void sleep(int milliSeconds)
41  */
42
43 static int sleepProc(Ejs *ep, EjsVar *thisObj, int argc, EjsVar **argv)
44 {
45         ejsTrace(ep, "sleep()\n");
46         return 0;
47 }
48
49 #endif
50 /******************************************************************************/
51 /*
52  *      function void exit(int status)
53  *
54  *      Exit the widget with the given status. All JavaScript processing ceases.
55  */
56
57 static int exitProc(Ejs *ep, EjsVar *thisObj, int argc, EjsVar **argv)
58 {
59         int             status;
60
61         status = 0;
62         if ((argc == 1) && ejsVarIsInteger(argv[0])) {
63                 status = argv[0]->integer;
64         }
65         ejsExit(ep, status);
66         return 0;
67 }
68
69 /******************************************************************************/
70 /******************************** Initialization ******************************/
71 /******************************************************************************/
72
73 int ejsDefineSystemClass(Ejs *ep)
74 {
75         EjsVar  *systemClass;
76
77         /*
78          *      We create the system class and define static methods on it.
79          *      NOTE: There is no object instance
80          */
81         systemClass =  ejsDefineClass(ep, "System", "Object", 0);
82         if (systemClass == 0) {
83                 return MPR_ERR_CANT_INITIALIZE;
84         }
85
86         ejsDefineCMethod(ep, systemClass, "exit", exitProc, EJS_NO_LOCAL);
87
88 #if UNUSED
89         ejsDefineCMethod(ep, systemClass, "random", randomProc, EJS_NO_LOCAL);
90         ejsDefineCMethod(ep, systemClass, "yield", yieldProc, EJS_NO_LOCAL);
91         ejsDefineCMethod(ep, systemClass, "sleep", sleepProc, EJS_NO_LOCAL);
92
93         /*
94          *      Define properties 
95          */
96         ejsSetPropertyToString(systemClass, "name", "");
97 #endif
98
99         return ejsObjHasErrors(systemClass) ? MPR_ERR_CANT_INITIALIZE : 0;
100 }
101
102 /******************************************************************************/
103
104 /*
105  * Local variables:
106  * tab-width: 4
107  * c-basic-offset: 4
108  * End:
109  * vim:tw=78
110  * vim600: sw=4 ts=4 fdm=marker
111  * vim<600: sw=4 ts=4
112  */