]> 4ch.mooo.com Git - 16.git/blob - src/palllist.c
i did a butt load of tweaking to the paltest code and i did verious fixes here and...
[16.git] / src / palllist.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 /*\r
23  * palllist experiment\r
24  */\r
25 /*\r
26  * An experiment where I make 2 small linked list which points to 2 arrays\r
27  * one is the "hardware palette" array\r
28  * the other is "image palette" array\r
29  * and their respectable pointers point to their [i] stuff\r
30  *\r
31  * the palette updater stuff i want to make is this:\r
32  *\r
33  * VGA          IMG\r
34  * 1-                   2-\r
35  * 2-                   4-\r
36  * 3-                   0-\r
37  * 4-                   9-\r
38  * 5-                   0-(I will figure this out later if  there is dup numbs)\r
39  * 6-\r
40  * 7-\r
41  * 8-\r
42  *\r
43  *              MERGE THEM INTO\r
44  *\r
45  * VGA\r
46  * 1-\r
47  * 2->IMG[0]\r
48  * 3-\r
49  * 4->IMG[1]\r
50  * 5\r
51  * 6\r
52  * 7\r
53  * 8\r
54  * 9->IMG[3]\r
55  * 0->IMG[2]->IMG[4]\r
56  *\r
57  * 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
58  * ==== 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
59  */\r
60 #include "src/lib/ll.h"\r
61 \r
62 #if 0\r
63 //def OTHERMERGELISTSTIFF\r
64 \r
65 void\r
66 main(int argc, char *argv[])\r
67 {\r
68         int i;\r
69         node_t * vga = NULL;                    node_t * imgpal = NULL;\r
70         vga = malloc(sizeof(node_t));   imgpal = malloc(sizeof(node_t));\r
71         vga->val = 24;                  imgpal->val = 9;\r
72         vga->next=NULL;                 imgpal->next=NULL;\r
73         vga->id=0;                              imgpal->id=0;\r
74 \r
75         printf("        ");\r
76         for(i=1; i<=\r
77                 //PAL_SIZE\r
78                 6\r
79                 ; i++)\r
80         {\r
81                 if(!(i%3)) printf("\n   ");\r
82                 printf("%d,", i);\r
83                 pushe(vga, i);\r
84         }\r
85 \r
86         printf("\n\n    ");\r
87 \r
88         for(i=4; i>0; i--)\r
89         {\r
90                 if(!(i%3)) printf("\n   ");\r
91                 printf("%d,", i);\r
92                 pushe(imgpal, i);\r
93         }\r
94         printf("\n");\r
95 \r
96         printf("size of vga = %d\n", listLength(vga));\r
97 //#if 0\r
98         printf("\n=======================\n");\r
99         printf("vga list printings\n=======================\n");\r
100         print_list(vga);\r
101         printf("\n=======================\n");\r
102         printf("imgpal list printings\n=======================\n");\r
103         print_list(imgpal);\r
104 //      printf("\n=======================\n");\r
105 //#endif\r
106         i=1;//skip overscan\r
107         while(i!=listLength(imgpal))\r
108         {\r
109                 \r
110         }\r
111         free(vga);\r
112         free(imgpal);\r
113 }\r
114 #else\r
115 #if 0\r
116 /* C/C++ program to merge two sorted linked lists */\r
117 //      from http://www.geeksforgeeks.org/merge-two-sorted-linked-lists/\r
118 \r
119 /* Drier program to test above functions*/\r
120 void main()\r
121 {\r
122         /* Start with the empty list */\r
123         struct node* res = NULL;\r
124         struct node* a = NULL;\r
125         struct node* b = NULL;\r
126 \r
127         /* Let us create two sorted linked lists to test\r
128           the functions\r
129            Created lists, a: 5->10->15,  b: 2->3->20 */\r
130         pushll(&a, 15);\r
131         pushll(&a, 10);\r
132         pushll(&a, 4);\r
133         pushll(&a, 3);\r
134         pushll(&a, 2);\r
135         pushll(&a, 1);\r
136         pushll(&a, 0);\r
137 \r
138         pushll(&b, 20);\r
139         pushll(&b, 3);\r
140         pushll(&b, 2);\r
141         pushll(&b, 4);\r
142 \r
143         printf("\n");\r
144         printf("The 2 Linked List are: \n");\r
145         printList(a);   printf("\n");\r
146         printList(b);   printf("\n");\r
147 \r
148         /* Remove duplicates from linked list */\r
149         res = SortedMerge(a, b);\r
150 //      res = LL_merge(a, b);\r
151         \r
152         printf("Merged Linked List is: \n");\r
153         printList(res);\r
154 }\r
155 #endif\r
156 /* C Program to remove duplicates from a sorted linked list */\r
157 \r
158 /* Drier program to test above functions*/\r
159 void main()\r
160 {\r
161         /* Start with the empty list */\r
162         struct node* head = NULL;\r
163    \r
164         /* Let us create a sorted linked list to test the functions\r
165          Created linked list will be 11->11->11->13->13->20 */\r
166         pushll(&head, 20);\r
167         pushll(&head, 13);\r
168         pushll(&head, 13);\r
169         pushll(&head, 11);\r
170         pushll(&head, 11);\r
171         pushll(&head, 11);\r
172 \r
173         printf("\n Linked list before duplicate removal  ");\r
174         printList(head);\r
175 \r
176         /* Remove duplicates from linked list */\r
177         removeDuplicates(head);\r
178 \r
179         printf("\n Linked list after duplicate removal ");\r
180         printList(head);\r
181 }\r
182 #endif\r