annotate Mac/Python/gusiconfig.cpp @ 19851:f3f694111ea0 legacy-trunk

Failing to import macfsn is not a fatal error.
author Jack Jansen <jack.jansen@cwi.nl>
date Tue, 11 Sep 2001 11:29:31 +0000
parents f29c766864cb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12281
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1 /*
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2 * Generated with the GUSIConfig application and then hand-modified by jack.
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3 */
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
5 #define GUSI_SOURCE
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
6 #include <GUSIConfig.h>
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
7 #include <sys/cdefs.h>
12446
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
8 #include <Resources.h>
12281
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 #include "Python.h"
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
11 #include "macglue.h"
12446
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
12 #include "pythonresources.h"
12281
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
13
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
14 static void
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15 PyMac_GUSISpin(bool wait)
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
16 {
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
17 static Boolean inForeground = true;
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
18 int maxsleep = 6; /* 6 ticks is "normal" sleeptime */
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
19
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
20 if (PyMac_ConsoleIsDead) return;
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
21
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
22 if ( !wait )
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
23 maxsleep = 0;
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
24
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
25 PyMac_DoYield(maxsleep, 0); /* XXXX or is it safe to call python here? */
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
26 }
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
27
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
28
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
29 /* Declarations of Socket Factories */
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
30
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
31 __BEGIN_DECLS
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
32 void GUSIwithInetSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
33 void GUSIwithLocalSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
34 void GUSIwithMTInetSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
35 void GUSIwithMTTcpSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
36 void GUSIwithMTUdpSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
37 void GUSIwithOTInetSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
38 void GUSIwithOTTcpSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
39 void GUSIwithOTUdpSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
40 void GUSIwithPPCSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
41 void GUSISetupFactories();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
42 __END_DECLS
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
43
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
44 /* Configure Socket Factories */
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
45
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
46 void GUSISetupFactories()
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
47 {
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
48 #ifdef GUSISetupFactories_BeginHook
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
49 GUSISetupFactories_BeginHook
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
50 #endif
14025
ae228a64293e Removed temporary code that always set creator to SimpleText.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12922
diff changeset
51 GUSIwithInetSockets();
12281
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
52 #ifdef GUSISetupFactories_EndHook
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
53 GUSISetupFactories_EndHook
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
54 #endif
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
55 }
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
56
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
57 /* Declarations of File Devices */
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
58
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
59 __BEGIN_DECLS
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
60 void GUSIwithDConSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
61 void GUSIwithNullSockets();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
62 void GUSISetupDevices();
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
63 __END_DECLS
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
64
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
65 /* Configure File Devices */
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
66
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
67 void GUSISetupDevices()
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
68 {
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
69 #ifdef GUSISetupDevices_BeginHook
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
70 GUSISetupDevices_BeginHook
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
71 #endif
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
72 #ifdef GUSISetupDevices_EndHook
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
73 GUSISetupDevices_EndHook
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
74 #endif
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
75 }
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
76
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
77 #ifndef __cplusplus
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
78 #error GUSISetupConfig() needs to be written in C++
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
79 #endif
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
80
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
81 GUSIConfiguration::FileSuffix sSuffices[] = {
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
82 "", '????', '????'
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
83 };
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
84 extern "C" void GUSISetupConfig()
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
85 {
12446
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
86 Handle h;
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
87 short oldrh, prefrh = -1;
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
88 short resource_id = GUSIConfiguration::kNoResource;
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
89
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
90 oldrh = CurResFile();
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
91
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
92 /* Try override from the application resource fork */
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
93 UseResFile(PyMac_AppRefNum);
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
94 h = Get1Resource('GU\267I', GUSIOPTIONSOVERRIDE_ID);
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
95 if ( h ) {
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
96 resource_id = GUSIOPTIONSOVERRIDE_ID;
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
97 } else {
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
98 /* Next try normal resource from preference file */
16836
f29c766864cb Reset the resource file chain before calling PyMac_OpenPrefFile. I'm not sure why this wasn't a problem before...
Jack Jansen <jack.jansen@cwi.nl>
parents: 15838
diff changeset
99 UseResFile(oldrh);
12446
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
100 prefrh = PyMac_OpenPrefFile();
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
101 h = Get1Resource('GU\267I', GUSIOPTIONS_ID);
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
102 if ( h ) {
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
103 resource_id = GUSIOPTIONS_ID;
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
104 } else {
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
105 /* Finally try normal resource from application */
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
106 if ( prefrh != -1 ) {
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
107 CloseResFile(prefrh);
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
108 prefrh = -1;
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
109 }
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
110 resource_id = GUSIOPTIONS_ID;
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
111 }
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
112 }
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
113
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
114 /* Now we have the right resource file topmost and the id. Init GUSI. */
12281
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
115 GUSIConfiguration * config =
12446
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
116 GUSIConfiguration::CreateInstance(resource_id);
12281
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
117
12446
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
118 /* Finally restore the old resource file */
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
119 if ( prefrh != -1) CloseResFile(prefrh);
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
120 UseResFile(oldrh);
e367ad3ea59a Made the GUSI options work again with GUSI 2.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12281
diff changeset
121
14025
ae228a64293e Removed temporary code that always set creator to SimpleText.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12922
diff changeset
122 config->ConfigureDefaultTypeCreator('TEXT', 'R*ch');
ae228a64293e Removed temporary code that always set creator to SimpleText.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12922
diff changeset
123 #if 0
12281
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
124 config->ConfigureSuffices(
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
125 sizeof(sSuffices)/sizeof(GUSIConfiguration::FileSuffix)-1, sSuffices);
14025
ae228a64293e Removed temporary code that always set creator to SimpleText.
Jack Jansen <jack.jansen@cwi.nl>
parents: 12922
diff changeset
126 #endif
12281
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
127 config->ConfigureAutoInitGraf(false);
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
128 config->ConfigureAutoSpin(false);
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
129 config->ConfigureHandleAppleEvents(false);
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
130 config->ConfigureSigInt(false);
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
131 config->ConfigureSigPipe(true);
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
132
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
133 GUSISetHook(GUSI_SpinHook, (GUSIHook)PyMac_GUSISpin);
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
134
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
135 }
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
136
51c0c3b6d919 Started on GUSI2 and threading support.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
137 /**************** END GUSI CONFIGURATION *************************/