Usermode/ATE - Stub edit code
authorJohn Hodge (sonata) <[email protected]>
Tue, 16 Oct 2012 07:25:29 +0000 (15:25 +0800)
committerJohn Hodge (sonata) <[email protected]>
Tue, 16 Oct 2012 07:25:29 +0000 (15:25 +0800)
Usermode/Applications/gui_ate_src/edit.c [new file with mode: 0644]
Usermode/Applications/gui_ate_src/include/file.h [new file with mode: 0644]
Usermode/Applications/gui_ate_src/include/syntax.h [new file with mode: 0644]

diff --git a/Usermode/Applications/gui_ate_src/edit.c b/Usermode/Applications/gui_ate_src/edit.c
new file mode 100644 (file)
index 0000000..8e1f01e
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Acess Text Editor (ATE)
+ * - By John Hodge (thePowersGang)
+ *
+ * edit.c
+ * - File Loading / Manipulation
+ */
+#include <stdio.h>
+#include "include/file.h"
+#include "include/syntax.h"
+
+// === CODE ===
+tFile *File_New(void)
+{
+       tFile *ret = malloc(sizeof(tFile) + 1);
+       ret->Handle = NULL;
+       ret->nLines = 0;
+       ret->Lines = NULL;
+       ret->NameOfs = 0;
+       ret->Path[0] = 0;
+       return ret;
+}
+
+tFile *File_Load(const char *Path)
+{
+       return NULL;
+}
+
+int File_Save(tFile *File)
+{
+       
+       //file->bIsDirty = 0;
+       return -1;
+}
+
+int File_Close(tFile *File, int bDiscard)
+{
+       //if( file->bIsDirty && !bDiscard )
+       //      return 1;
+       if( file->Handle )
+               fclose(File->Handle);
+       
+       return 0;
+}
+
diff --git a/Usermode/Applications/gui_ate_src/include/file.h b/Usermode/Applications/gui_ate_src/include/file.h
new file mode 100644 (file)
index 0000000..5eb15b0
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Acess Text Editor (ATE)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/file.h
+ * - In-memory file structures
+ */
+#ifndef _ATE__FILE_H_
+#define _ATE__FILE_H_
+#include <stdio.h>
+
+typedef struct sFileLine
+{
+        int    Num;
+
+       // State data for hilighting
+        int    HilightState;
+       char    *Rendered;
+
+        int    Space;
+        int    Length;
+       char    Data[];
+} tFileLine;
+
+typedef struct sFile
+{
+       FILE    *Handle;
+        int    nLines;
+       tFileLine       **Lines;        // TODO: Handle very large files?
+        int    NameOfs;
+       const char      Path[];
+} tFile;
+
+#endif
+
diff --git a/Usermode/Applications/gui_ate_src/include/syntax.h b/Usermode/Applications/gui_ate_src/include/syntax.h
new file mode 100644 (file)
index 0000000..99b35ce
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Acess Text Editor (ATE)
+ * - By John Hodge (thePowersGang)
+ *
+ * include/syntax.h
+ * - Syntax Hilighting / Rendering structures
+ */
+#ifndef _ATE__SYNTAX_H_
+#define _ATE__SYNTAX_H_
+
+#endif
+

UCC git Repository :: git.ucc.asn.au