11/* Automatically generated by
2- VMPluginCodeGenerator * VMMaker.oscog-VB.2370 uuid: b61408e0-effc-5144-bd81-993254392346
2+ VMPluginCodeGenerator VMMaker.oscog-VB.2382 uuid: da8a5d36-0cd4-b641-865f-a139b3914245
33 from
4- FilePlugin * VMMaker.oscog-VB.2370 uuid: b61408e0-effc-5144-bd81-993254392346
4+ FilePlugin VMMaker.oscog-VB.2382 uuid: da8a5d36-0cd4-b641-865f-a139b3914245
55 */
6- static char __buildInfo [] = "FilePlugin * VMMaker.oscog-VB.2370 uuid: b61408e0-effc-5144-bd81-993254392346 " __DATE__ ;
6+ static char __buildInfo [] = "FilePlugin VMMaker.oscog-VB.2382 uuid: da8a5d36-0cd4-b641-865f-a139b3914245 " __DATE__ ;
77
88
99
@@ -85,6 +85,7 @@ EXPORT(sqInt) primitiveDisableFileAccess(void);
8585EXPORT (sqInt ) primitiveFileAtEnd (void );
8686EXPORT (sqInt ) primitiveFileClose (void );
8787EXPORT (sqInt ) primitiveFileDelete (void );
88+ EXPORT (sqInt ) primitiveFileDescriptorType (void );
8889EXPORT (sqInt ) primitiveFileFlush (void );
8990EXPORT (sqInt ) primitiveFileGetPosition (void );
9091EXPORT (sqInt ) primitiveFileOpen (void );
@@ -100,7 +101,6 @@ EXPORT(sqInt) primitiveFileSync(void);
100101EXPORT (sqInt ) primitiveFileTruncate (void );
101102EXPORT (sqInt ) primitiveFileWrite (void );
102103EXPORT (sqInt ) primitiveHasFileAccess (void );
103- EXPORT (sqInt ) primitiveIsFileDescriptorATTY (void );
104104EXPORT (sqInt ) setInterpreter (struct VirtualMachine * anInterpreter );
105105EXPORT (sqInt ) setMacFileTypeAndCreator (char * fileName , char * typeString , char * creatorString );
106106EXPORT (sqInt ) shutdownModule (void );
@@ -144,6 +144,7 @@ static sqInt (*primitiveFail)(void);
144144static sqInt (* primitiveFailFor )(sqInt reasonCode );
145145static sqInt (* primitiveFailureCode )(void );
146146static sqInt (* pushBool )(sqInt trueOrFalse );
147+ static sqInt (* pushInteger )(sqInt integerValue );
147148static sqInt (* pushRemappableOop )(sqInt oop );
148149static sqInt (* slotSizeOf )(sqInt oop );
149150static sqInt (* stSizeOf )(sqInt oop );
@@ -177,8 +178,8 @@ extern sqInt integerValueOf(sqInt oop);
177178extern void * ioLoadFunctionFrom (char * functionName , char * moduleName );
178179extern sqInt isKindOf (sqInt oop , char * aString );
179180extern sqInt isBytes (sqInt oop );
180- extern sqInt isIntegerObject (sqInt objectPointer );
181181#if !defined(isIntegerObject )
182+ extern sqInt isIntegerObject (sqInt objectPointer );
182183#endif
183184extern sqInt isWords (sqInt oop );
184185extern sqInt isWordsOrBytes (sqInt oop );
@@ -195,6 +196,7 @@ extern sqInt primitiveFail(void);
195196extern sqInt primitiveFailFor (sqInt reasonCode );
196197extern sqInt primitiveFailureCode (void );
197198extern sqInt pushBool (sqInt trueOrFalse );
199+ extern sqInt pushInteger (sqInt integerValue );
198200extern sqInt pushRemappableOop (sqInt oop );
199201extern sqInt slotSizeOf (sqInt oop );
200202extern sqInt stSizeOf (sqInt oop );
@@ -209,9 +211,9 @@ extern
209211struct VirtualMachine * interpreterProxy ;
210212static const char * moduleName =
211213#ifdef SQUEAK_BUILTIN_PLUGIN
212- "FilePlugin * VMMaker.oscog-VB.2370 (i)"
214+ "FilePlugin VMMaker.oscog-VB.2382 (i)"
213215#else
214- "FilePlugin * VMMaker.oscog-VB.2370 (e)"
216+ "FilePlugin VMMaker.oscog-VB.2382 (e)"
215217#endif
216218;
217219static void * sCCPfn ;
@@ -1140,6 +1142,40 @@ primitiveFileDelete(void)
11401142 return 0 ;
11411143}
11421144
1145+
1146+ /* Allow to test if the standard input/output files are from a console or not
1147+ Return values:
1148+ * -1 - Error
1149+ * 0 - no console (windows only)
1150+ * 1 - normal terminal (unix terminal / windows console)
1151+ * 2 - pipe
1152+ * 3 - file
1153+ * 4 - cygwin terminal (windows only) */
1154+
1155+ /* FilePlugin>>#primitiveFileDescriptorType */
1156+ EXPORT (sqInt )
1157+ primitiveFileDescriptorType (void )
1158+ {
1159+ int fd ;
1160+ sqInt fdPointer ;
1161+ sqInt fileType ;
1162+
1163+ fdPointer = stackValue (0 );
1164+ if (!(isIntegerObject (fdPointer ))) {
1165+ return primitiveFailFor (PrimErrBadArgument );
1166+ }
1167+ fd = integerValueOf (fdPointer );
1168+ if (failed ()) {
1169+
1170+ /* Ensure that the appropriate failure code has been set */
1171+ return primitiveFailFor (PrimErrBadArgument );
1172+ }
1173+ fileType = sqFileDescriptorType (fd );
1174+ pop (2 );
1175+ pushInteger (fileType );
1176+ return 0 ;
1177+ }
1178+
11431179 /* FilePlugin>>#primitiveFileFlush */
11441180EXPORT (sqInt )
11451181primitiveFileFlush (void )
@@ -1725,30 +1761,6 @@ primitiveHasFileAccess(void)
17251761 return 0 ;
17261762}
17271763
1728- /* FilePlugin>>#primitiveIsFileDescriptorATTY */
1729- EXPORT (sqInt )
1730- primitiveIsFileDescriptorATTY (void )
1731- {
1732- int fd ;
1733- sqInt fdPointer ;
1734- sqInt isStdoutRedirected ;
1735-
1736- fdPointer = stackValue (0 );
1737- if (!(isIntegerObject (fdPointer ))) {
1738- return primitiveFailFor (PrimErrBadArgument );
1739- }
1740- fd = integerValueOf (fdPointer );
1741- if (failed ()) {
1742-
1743- /* Ensure that the appropriate failure code has been set */
1744- return primitiveFailFor (PrimErrBadArgument );
1745- }
1746- isStdoutRedirected = sqIsFileDescriptorATTY (fd ) ;
1747- pop (2 );
1748- pushBool (isStdoutRedirected );
1749- return 0 ;
1750- }
1751-
17521764
17531765/* Note: This is coded so that it can be run in Squeak. */
17541766
@@ -1805,6 +1817,7 @@ setInterpreter(struct VirtualMachine*anInterpreter)
18051817 primitiveFailFor = interpreterProxy -> primitiveFailFor ;
18061818 primitiveFailureCode = interpreterProxy -> primitiveFailureCode ;
18071819 pushBool = interpreterProxy -> pushBool ;
1820+ pushInteger = interpreterProxy -> pushInteger ;
18081821 pushRemappableOop = interpreterProxy -> pushRemappableOop ;
18091822 slotSizeOf = interpreterProxy -> slotSizeOf ;
18101823 stSizeOf = interpreterProxy -> stSizeOf ;
@@ -1862,6 +1875,7 @@ void* FilePlugin_exports[][3] = {
18621875 {(void * )_m , "primitiveFileAtEnd\000\001" , (void * )primitiveFileAtEnd },
18631876 {(void * )_m , "primitiveFileClose\000\001" , (void * )primitiveFileClose },
18641877 {(void * )_m , "primitiveFileDelete\000\001" , (void * )primitiveFileDelete },
1878+ {(void * )_m , "primitiveFileDescriptorType\000\000" , (void * )primitiveFileDescriptorType },
18651879 {(void * )_m , "primitiveFileFlush\000\001" , (void * )primitiveFileFlush },
18661880 {(void * )_m , "primitiveFileGetPosition\000\001" , (void * )primitiveFileGetPosition },
18671881 {(void * )_m , "primitiveFileOpen\000\002" , (void * )primitiveFileOpen },
@@ -1875,7 +1889,6 @@ void* FilePlugin_exports[][3] = {
18751889 {(void * )_m , "primitiveFileTruncate\000\001" , (void * )primitiveFileTruncate },
18761890 {(void * )_m , "primitiveFileWrite\000\001" , (void * )primitiveFileWrite },
18771891 {(void * )_m , "primitiveHasFileAccess\000\377" , (void * )primitiveHasFileAccess },
1878- {(void * )_m , "primitiveIsFileDescriptorATTY\000\000" , (void * )primitiveIsFileDescriptorATTY },
18791892 {(void * )_m , "setInterpreter" , (void * )setInterpreter },
18801893 {(void * )_m , "setMacFileTypeAndCreator" , (void * )setMacFileTypeAndCreator },
18811894 {(void * )_m , "shutdownModule\000\377" , (void * )shutdownModule },
@@ -1895,6 +1908,7 @@ signed char primitiveDirectorySetMacTypeAndCreatorAccessorDepth = 1;
18951908signed char primitiveFileAtEndAccessorDepth = 1 ;
18961909signed char primitiveFileCloseAccessorDepth = 1 ;
18971910signed char primitiveFileDeleteAccessorDepth = 1 ;
1911+ signed char primitiveFileDescriptorTypeAccessorDepth = 0 ;
18981912signed char primitiveFileFlushAccessorDepth = 1 ;
18991913signed char primitiveFileGetPositionAccessorDepth = 1 ;
19001914signed char primitiveFileOpenAccessorDepth = 2 ;
@@ -1906,6 +1920,5 @@ signed char primitiveFileSizeAccessorDepth = 1;
19061920signed char primitiveFileSyncAccessorDepth = 1 ;
19071921signed char primitiveFileTruncateAccessorDepth = 1 ;
19081922signed char primitiveFileWriteAccessorDepth = 1 ;
1909- signed char primitiveIsFileDescriptorATTYAccessorDepth = 0 ;
19101923
19111924#endif /* ifdef SQ_BUILTIN_PLUGIN */
0 commit comments