Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement new R15 efile driver API

  • Loading branch information...
commit b62dbb5351546c8892d083535e8ee1f6d7294f19 1 parent 5c40a18
@krestenkrab krestenkrab authored
Showing with 26 additions and 5 deletions.
  1. +26 −5 src/main/java/erjang/driver/efile/EFile.java
View
31 src/main/java/erjang/driver/efile/EFile.java
@@ -358,6 +358,7 @@ public void deq_free_size() {
public static final byte FILE_RESP_EOF = 8;
public static final byte FILE_RESP_FNAME = 9;
public static final byte FILE_RESP_ALL_DATA = 10;
+ public static final byte FILE_RESP_LFNAME = 11;
private static final byte[] FILE_RESP_ALL_DATA_HEADER = new byte[]{ FILE_RESP_ALL_DATA };
/* Options */
@@ -1571,7 +1572,7 @@ public void ready() throws Pausable {
return;
}
- final int RESULT_SIZE = (1 + (29 * 4));
+ final int RESULT_SIZE = (1 + (17 * 4));
ByteBuffer res = ByteBuffer.allocate(RESULT_SIZE);
res.order(ByteOrder.BIG_ENDIAN);
@@ -1580,9 +1581,13 @@ public void ready() throws Pausable {
res.putLong(file_size);
res.putInt(file_type);
- put_time(res, file_access_time);
- put_time(res, file_modify_time);
- put_time(res, file_create_time);
+ res.putLong(file_access_time);
+ res.putLong(file_modify_time);
+ res.putLong(file_create_time);
+
+ //put_time(res, file_access_time);
+ //put_time(res, file_modify_time);
+ //put_time(res, file_create_time);
res.putInt(file_mode);
res.putInt(1 /*file_links*/);
@@ -1929,7 +1934,19 @@ public String toString() {
void reply_list_directory(String[] files) throws Pausable {
for (int i = 0; i < files.length; i++) {
- if (isUnicodeDriverInterface()) {
+ if (isLFNameDriverInterface()) {
+ // prim_file interface from R15 on
+ ByteBuffer reply = ByteBuffer.allocate(1);
+ reply.put(FILE_RESP_LFNAME);
+
+ ByteBuffer data = ByteBuffer.allocate(2+files[i].length());
+ data.limit(data.capacity());
+ data.position(0);
+ data.putShort((short)files[i].length());
+ IO.putstr(data, files[i], false);
+
+ driver_output2(reply, data);
+ } else if (isUnicodeDriverInterface()) {
// prim_file interface from R14 on
ByteBuffer reply = ByteBuffer.allocate(1);
reply.put(FILE_RESP_FNAME);
@@ -1972,4 +1989,8 @@ void reply_list_directory(String[] files) throws Pausable {
private static boolean isUnicodeDriverInterface() {
return ERT.runtime_info.unicodeDriverInterface;
}
+
+ private static boolean isLFNameDriverInterface() {
+ return ERT.runtime_info.unicodeDriverInterface;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.