#vgacamm.exe: vgacamm.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
palettec.exe: palettec.$(OBJ) gfx.lib $(DOSLIB)
palettel.exe: palettel.$(OBJ) gfx.lib $(DOSLIB)
-palllist.exe: palllist.$(OBJ) gfx.lib $(DOSLIB)
+palllist.exe: palllist.$(OBJ) gfx.lib $(DOSLIB) ll.$(OBJ)
pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib $(DOSLIB)
#planrpcx.exe: planrpcx.$(OBJ) gfx.lib
maptest.exe: maptest.$(OBJ) 16_map.$(OBJ) 16_head.$(OBJ) gfx.lib $(DOSLIB) $(16LIB)
#memory.$(OBJ):$(EXMMLIB)/memory.c $(EXMMLIB)/memory.h
c_utils.$(OBJ):$(MODEXLIB)/c_utils.asm
modex.$(OBJ): $(MODEXLIB)/modex.asm
+ll.$(OBJ): $(SRCLIB)/ll.c $(SRCLIB)/ll.h
#
#other~
--- /dev/null
+#include "src/lib/ll.h"\r
+\r
+void print_list(node_t * head)\r
+{\r
+ node_t * current = head;\r
+\r
+ while (current != NULL)\r
+ {\r
+ printf("%d\n", current->val);\r
+ current = current->next;\r
+ }\r
+}\r
+\r
+void pushe(node_t * head, int val)\r
+{\r
+ node_t * current = head;\r
+ while (current->next != NULL)\r
+ {\r
+ current = current->next;\r
+ }\r
+\r
+ // now we can add a new variable\r
+ current->next = malloc(sizeof(node_t));\r
+ current->next->val = val;\r
+ current->next->next = NULL;\r
+}\r
+\r
+void pushs(node_t ** head, int val)\r
+{\r
+ node_t * new_node;\r
+ new_node = malloc(sizeof(node_t));\r
+\r
+ new_node->val = val;\r
+ new_node->next = *head;\r
+ *head = new_node;\r
+}\r
+\r
+int pop(node_t ** head)\r
+{\r
+ int retval = -1;\r
+ node_t * next_node = NULL;\r
+\r
+ if (*head == NULL) {\r
+ return -1;\r
+ }\r
+\r
+ next_node = (*head)->next;\r
+ retval = (*head)->val;\r
+ free(*head);\r
+ *head = next_node;\r
+\r
+ return retval;\r
+}\r
+\r
+int remove_last(node_t * head)\r
+{\r
+ int retval = 0;\r
+ node_t * current;\r
+\r
+ /* if there is only one item in the list, remove it */\r
+ if (head->next == NULL) {\r
+ retval = head->val;\r
+ free(head);\r
+ return retval;\r
+ }\r
+\r
+ /* get to the last node in the list */\r
+ current = head;\r
+ while (current->next->next != NULL) {\r
+ current = current->next;\r
+ }\r
+\r
+ /* now current points to the last item of the list, so let's remove current->next */\r
+ retval = current->next->val;\r
+ free(current->next);\r
+ current->next = NULL;\r
+ return retval;\r
+\r
+}\r
+\r
+int remove_by_index(node_t ** head, int n)\r
+{\r
+ int i = 0;\r
+ int retval = -1;\r
+ node_t * current = *head;\r
+ node_t * temp_node = NULL;\r
+\r
+ if (n == 0) {\r
+ return pop(head);\r
+ }\r
+\r
+ for (i = 0; i < n-1; i++) {\r
+ if (current->next == NULL) {\r
+ return -1;\r
+ }\r
+ current = current->next;\r
+ }\r
+\r
+ temp_node = current->next;\r
+ retval = temp_node->val;\r
+ current->next = temp_node->next;\r
+ free(temp_node);\r
+\r
+ return retval;\r
+}\r
--- /dev/null
+#ifndef __LL_H__\r
+#define __LL_H__\r
+#include <stdio.h>\r
+#include "src/lib/16_tail.h"\r
+\r
+typedef struct node\r
+{\r
+ struct node *prev;\r
+ rgb_t d;\r
+ int val;\r
+ struct node *next;\r
+} node_t;\r
+\r
+void print_list(node_t * head);\r
+void pushe(node_t * head, int val);\r
+void pushs(node_t ** head, int val);\r
+int pop(node_t ** head);\r
+int remove_last(node_t * head);\r
+int remove_by_index(node_t ** head, int n);\r
+\r
+#endif\r
* i am going to work on a really big area of code it will be on the refresh system, the walking/scrolling system, things that use showpage, adding disableing 8087 functions if no 8087 detected, and a bunch of other things i cannot remember off the top of my head because i am BURNT. I need a small break~ -- -- -- -- update! i am working on this i made ZC_WALK and i am going to move to VRL/VRS soon! .\r
* ==== PRE SHOWPAGE TO SHOWMV CONVERSION ==== i am going to work on a really big area of code it will be on the refresh system, the walking/scrolling system, things that use showpage, adding disableing 8087 functions if no 8087 detected, and a bunch of other things i cannot remember off the top of my head because i am BURNT. I need a small break~ -- -- -- -- update! i am working on this i made ZC_WALK and i am going to move to VRL/VRS soon!\r
*/\r
-#include <stdio.h>\r
+#include "src/lib/ll.h"\r
\r
void\r
main(int argc, char *argv[])\r
{\r
-//TOO TIREDWWWW\r
+ int i;\r
+ node_t * head = NULL; node_t * heao = NULL;\r
+ node_t * nx = NULL;\r
+ head = malloc(sizeof(node_t)); heao = malloc(sizeof(node_t));\r
+ head->val = 0; heao->val = 9;\r
+ head->next=NULL; heao->next=NULL;\r
+\r
+ nx = head;\r
+ for(i=1; i<\r
+ //PAL_SIZE\r
+ 5\r
+ ; i++)\r
+ {\r
+ printf(" i=%d\n", i);\r
+ pushe(nx, i);\r
+ nx = nx->next;\r
+ }\r
+ nx->next = NULL;\r
+\r
+ nx = heao;\r
+ for(i=8; i>0; i--)\r
+ {\r
+ printf(" i=%d\n", i);\r
+ pushe(nx, i);\r
+ nx = nx->next;\r
+ }\r
+ nx->next = NULL;\r
+ print_list(head);\r
+ printf("\n");\r
+ print_list(heao);\r
+ free(head);\r
+ free(heao);\r
}\r