Modules/UDI - NSR TX
[tpg/acess2.git] / KernelLand / Modules / Interfaces / UDI / udi_lib / core / buf.c
index 5327cc8..a9df466 100644 (file)
@@ -6,6 +6,30 @@
  */
 #include <acess.h>
 #include <udi.h>
+#include <udi_internal.h>
+
+typedef struct sUDI_BufTag
+{
+       struct sUDI_BufTag      *Next;
+//     udi_buf_tag_t   tag;
+       struct sUDI_BufSect     *Sect;
+} tUDI_BufTag;
+
+typedef struct sUDI_BufSect
+{
+       struct sUDI_BufSect     *Next;
+       size_t  Offset;
+       size_t  Length;
+       size_t  Space;
+       // data
+} tUDI_BufSect;
+
+typedef struct
+{
+       udi_buf_t       buf;
+       tUDI_BufTag     *Tags;
+       tUDI_BufSect    *Sections;
+} tUDI_BufInt;
 
 // === EXPORTS ===
 EXPORT(udi_buf_copy);
@@ -37,8 +61,7 @@ void udi_buf_copy(
  * \param src_len      Length of source data
  * \param dst_buf      Destination buffer
  * \param dst_off      Destination offset in the buffer
- * \param dst_len      Length of destination area (What the?, Redundant
- *                     Department of redundacny department)
+ * \param dst_len      Length of destination area
  * \param path_handle  ???
  */
 void udi_buf_write(
@@ -52,7 +75,38 @@ void udi_buf_write(
        udi_buf_path_t path_handle
        )
 {
-       UNIMPLEMENTED();
+       tUDI_BufInt     *dst = (void*)dst_buf;
+       if( !dst ) {
+               dst = NEW(tUDI_BufInt,);
+       }
+       
+       if( dst_len == 0 )
+       {
+               // Insert / Initialise
+               if( src_len > 0 )
+               {
+                       Log_Warning("UDI", "TODO: udi_buf_write - insert");
+               }
+               // no-op
+               else
+               {
+               }
+       }
+       else
+       {
+               // Overwrite
+               if( src_len > 0 )
+               {
+                       Log_Warning("UDI", "TODO: udi_buf_write - overwrite");
+               }
+               // Delete
+               else
+               {
+                       Log_Warning("UDI", "TODO: udi_buf_write - delete");
+               }
+       }
+       
+       callback(gcb, &dst->buf);
 }
 
 void udi_buf_read(

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