]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: looks like ERROR_C_STRING is never thrown, so it can be removed
authorBjörn Lindqvist <bjourne@gmail.com>
Tue, 29 Sep 2015 20:21:26 +0000 (22:21 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Tue, 29 Sep 2015 21:12:56 +0000 (23:12 +0200)
basis/alien/data/data-docs.factor
basis/debugger/debugger-docs.factor
basis/debugger/debugger.factor
core/kernel/kernel.factor
vm/errors.hpp

index ae8556fa7d034b86bc310bf73ece4035f415dcb5..1ba03b07e569c62bab4bf06240f531f6a1cbf071 100644 (file)
@@ -183,8 +183,6 @@ ARTICLE: "c-strings" "C strings"
 $nl
 "Passing a Factor string to a C function expecting a " { $link c-string } " allocates a " { $link byte-array } " in the Factor heap; the string is then converted to the requested format and a raw pointer is passed to the function."
 $nl
-"If the conversion fails, for example if the string contains null bytes or characters with values higher than 255, a " { $link c-string-error. } " is thrown."
-$nl
 "Care must be taken if the C function expects a pointer to a string with its length represented by another parameter rather than a null terminator. Passing the result of calling " { $link length } " on the string object will not suffice. This is because a Factor string of " { $emphasis "n" } " characters will not necessarily encode to " { $emphasis "n" } " bytes. The correct idiom for C functions which take a string with a length is to first encode the string using " { $link encode } ", and then pass the resulting byte array together with the length of this byte array."
 $nl
 "Sometimes a C function has a parameter type of " { $link void* } ", and various data types, among them strings, can be passed in. In this case, strings are not automatically converted to aliens, and instead you must call one of these words:"
index e673fb0b2f1fa86f5b282fb44485f4c9e7f9daad..bccb38f97e5b54b7f276bfdd6be60eeabff94b4f 100644 (file)
@@ -122,9 +122,6 @@ HELP: signal-error.
 HELP: array-size-error.
 { $error-description "Thrown by " { $link <array> } ", " { $link <string> } ", " { $link <vector> } " and " { $link <sbuf> } " if the specified capacity is negative or too large." } ;
 
-HELP: c-string-error.
-{ $error-description "Thrown by " { $link alien-invoke } " and various primitives if a string containing null bytes, or characters with values higher than 255 is passed in where a C string is expected. See " { $link "c-strings" } "." } ;
-
 HELP: ffi-error.
 { $error-description "Thrown by " { $link dlopen } " and " { $link dlsym } " if a problem occurs while loading a native library or looking up a symbol. See " { $link "alien" } "." } ;
 
index e95253d0558c9c6c61fa620d8d91fa8b567dfdf1..50a13b5008c73e6866ec581bea6071681b7e2914 100755 (executable)
@@ -104,9 +104,6 @@ HOOK: signal-error. os ( obj -- )
 : fixnum-range-error. ( obj -- )
     "Cannot convert to fixnum: " write third . ;
 
-: c-string-error. ( obj -- )
-    "Cannot convert to C string: " write third . ;
-
 : ffi-error. ( obj -- )
     "FFI error" print drop ;
 
@@ -169,7 +166,6 @@ PREDICATE: vm-error < array
         [ signal-error.            ]
         [ array-size-error.        ]
         [ fixnum-range-error.      ]
-        [ c-string-error.          ]
         [ ffi-error.               ]
         [ undefined-symbol-error.  ]
         [ datastack-underflow.     ]
index c38206198c8178fe2bda8f999a90956f8801eb75..611ba18d97d38ff19e7f6e18198b98bc0e95f8b0 100644 (file)
@@ -423,7 +423,7 @@ CONSTANT: CONTEXT-OBJ-IN-CALLBACK-P 3
 !   basis/debugger/debugger.factor
 !   vm/errors.hpp
 
-CONSTANT: kernel-error-count 21
+CONSTANT: kernel-error-count 20
 
 CONSTANT: ERROR-EXPIRED 0
 CONSTANT: ERROR-IO      1
@@ -433,19 +433,18 @@ CONSTANT: ERROR-DIVIDE-BY-ZERO 4
 CONSTANT: ERROR-SIGNAL 5
 CONSTANT: ERROR-ARRAY-SIZE 6
 CONSTANT: ERROR-OUT-OF-FIXNUM-RANGE 7
-CONSTANT: ERROR-C-STRING 8
-CONSTANT: ERROR-FFI 9
-CONSTANT: ERROR-UNDEFINED-SYMBOL 10
-CONSTANT: ERROR-DATASTACK-UNDERFLOW 11
-CONSTANT: ERROR-DATASTACK-OVERFLOW 12
-CONSTANT: ERROR-RETAINSTACK-UNDERFLOW 13
-CONSTANT: ERROR-RETAINSTACK-OVERFLOW 14
-CONSTANT: ERROR-CALLSTACK-UNDERFLOW 15
-CONSTANT: ERROR-CALLSTACK-OVERFLOW 16
-CONSTANT: ERROR-MEMORY 17
-CONSTANT: ERROR-FP-TRAP 18
-CONSTANT: ERROR-INTERRUPT 19
-CONSTANT: ERROR-CALLBACK-SPACE-OVERFLOW 20
+CONSTANT: ERROR-FFI 8
+CONSTANT: ERROR-UNDEFINED-SYMBOL 9
+CONSTANT: ERROR-DATASTACK-UNDERFLOW 10
+CONSTANT: ERROR-DATASTACK-OVERFLOW 11
+CONSTANT: ERROR-RETAINSTACK-UNDERFLOW 12
+CONSTANT: ERROR-RETAINSTACK-OVERFLOW 13
+CONSTANT: ERROR-CALLSTACK-UNDERFLOW 14
+CONSTANT: ERROR-CALLSTACK-OVERFLOW 15
+CONSTANT: ERROR-MEMORY 16
+CONSTANT: ERROR-FP-TRAP 17
+CONSTANT: ERROR-INTERRUPT 18
+CONSTANT: ERROR-CALLBACK-SPACE-OVERFLOW 19
 
 PRIMITIVE: callstack-for ( context -- array )
 PRIMITIVE: retainstack-for ( context -- array )
index b43938e0a6551e7076947a92f8f2e76454f1b6ce..c865a827579523050ab27135b7843e9f180ae1f0 100644 (file)
@@ -12,7 +12,6 @@ enum vm_error_type {
   ERROR_SIGNAL,
   ERROR_ARRAY_SIZE,
   ERROR_OUT_OF_FIXNUM_RANGE,
-  ERROR_C_STRING,
   ERROR_FFI,
   ERROR_UNDEFINED_SYMBOL,
   ERROR_DATASTACK_UNDERFLOW,