xmltools-development Mailing List for xml handling tools
Status: Beta
Brought to you by:
nik_89
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(55) |
Sep
(5) |
Oct
(80) |
Nov
(20) |
Dec
(7) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: nik_89 <ni...@us...> - 2005-01-07 05:59:49
|
Update of /cvsroot/xmltools/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6228 Modified Files: getdata.c setdata.c testdata.c Log Message: the test programs Index: setdata.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/tests/setdata.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setdata.c 1 Nov 2004 18:02:41 -0000 1.2 --- setdata.c 7 Jan 2005 05:59:39 -0000 1.3 *************** *** 18,22 **** #include <stdio.h> ! #include "../src/xmltools.h" void test_adv_node(); --- 18,22 ---- #include <stdio.h> ! #include "../xmltools.h" void test_adv_node(); *************** *** 34,37 **** --- 34,38 ---- #endif + Xmltool_Clean(); return 0; } Index: getdata.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/tests/getdata.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** getdata.c 1 Nov 2004 18:02:40 -0000 1.2 --- getdata.c 7 Jan 2005 05:59:39 -0000 1.3 *************** *** 18,22 **** #include <stdio.h> ! #include "../src/xmltools.h" void test_adv_node2(); --- 18,22 ---- #include <stdio.h> ! #include "../xmltools.h" void test_adv_node2(); *************** *** 56,59 **** --- 56,60 ---- if (buf == NULL) { + Xmltool_Perror("1"); return; } Index: testdata.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/tests/testdata.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testdata.c 1 Nov 2004 18:02:41 -0000 1.2 --- testdata.c 7 Jan 2005 05:59:39 -0000 1.3 *************** *** 18,22 **** #include <stdio.h> ! #include "../src/xmltools.h" void test_adv_node2(); --- 18,22 ---- #include <stdio.h> ! #include "../xmltools.h" void test_adv_node2(); *************** *** 29,40 **** --- 29,55 ---- printf("will write\n"); test_adv_node(); + printf("done, press any key to continue\n"); + getchar(); printf("will read\n"); test_adv_node2(); + printf("will clean\n"); Xmltool_Clean(); + /* showMemStats(); */ + printf("done, press any key to continue\n"); + getchar(); + printf("unlinking the file\n"); + unlink("hou2.xml"); + printf("done, press any key to continue\n"); + getchar(); printf("will write\n"); test_adv_node(); + printf("done, press any key to continue\n"); + getchar(); printf("will read\n"); test_adv_node2(); Xmltool_Clean(); + /* showMemStats(); */ + printf("done, press any key to continue\n"); + getchar(); return 0; } *************** *** 88,92 **** void test_adv_node() { ! Nmap_Add("root", "foo", "bar"); if (Nmap_Add("root", "barba", "barb1") != 0) --- 103,108 ---- void test_adv_node() { ! if (Nmap_Add("root", "foo", "bar") != 0) ! Xmltool_Perror("node_add"); if (Nmap_Add("root", "barba", "barb1") != 0) *************** *** 106,110 **** Xmltool_Perror("node_add"); } ! /* p_allnodes(); */ Xmltool_MAddXml("hou2.xml"); --- 122,138 ---- Xmltool_Perror("node_add"); } ! Xmltool_MAddXml("hou2.xml"); ! ! if (Nmap_Add("root", "foo", "barb5") != 0) ! Xmltool_Perror("node_add"); ! if (Nmap_Add("root", "barba", "barb6") != 0) ! Xmltool_Perror("node_add"); ! if (Nmap_Add("root", "barbb", "barb7") != 0) ! Xmltool_Perror("node_add"); ! if (Nmap_Add("root", "barbc", "barb8") != 0) ! Xmltool_Perror("node_add"); ! if (Nmap_Add("root", "barbd", "barb9") != 0) ! Xmltool_Perror("node_add"); ! Xmltool_MAddXml("hou2.xml"); |
|
From: Eli G. <ego...@us...> - 2005-01-06 20:34:59
|
Update of /cvsroot/xmltools/xmltools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3592 Modified Files: xml-advhandler.h Log Message: Added doxygen comments to struct names, enums, constants, and functions. Index: xml-advhandler.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xml-advhandler.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xml-advhandler.h 26 Dec 2004 20:53:45 -0000 1.2 --- xml-advhandler.h 6 Jan 2005 20:34:46 -0000 1.3 *************** *** 3,7 **** * It provides an easy way to input and output configurations from/to xml files * and handlers to deal with small or big xml databases. ! * Copyright (C) 2004 Nicholas Niro * * This library is free software; you can redistribute it and/or --- 3,7 ---- * It provides an easy way to input and output configurations from/to xml files * and handlers to deal with small or big xml databases. ! * Copyright (C) 2004 Nicholas Niro and Eli Gottlieb * * This library is free software; you can redistribute it and/or *************** *** 29,35 **** * Made by Eli Gottlieb */ ! ! /* Node structure used to have nodes linked in the standard libxml way. */ enum simple_type { --- 29,38 ---- * Made by Eli Gottlieb */ + /*! \file xml-advhandler.h + * \brief The XMLTools advanced routines header.*/ ! /*! ! * Represents the simple types of data used in XML, currently always ST_CDATA. ! */ enum simple_type { *************** *** 45,48 **** --- 48,52 ---- ST_NONE = 9 }; + /*! Represents an attribute with a simple type, value, and name. */ struct attribute { *************** *** 53,57 **** unsigned long name_length; }; ! typedef struct Txmlnode { --- 57,61 ---- unsigned long name_length; }; ! /*! Represents a node in the XML tree. */ typedef struct Txmlnode { *************** *** 82,99 **** void* children; unsigned long num_children; ! }xmlnode; const xmlnode nil_node = {0,0,0,ST_NONE,0,0,0,0,0,0,0,0,0}; xmlnode get_node_by_type_attrib(char* filename,char* type,char* attribute_name,char* attribute_value); xmlnode get_node_by_index(char* filename,unsigned long index); xmlnode get_node_by_content(char* filename,int is_contents_complex,void* contents,unsigned long contents_size); xmlnode get_node_by_attribute(char* filename,char* attribute_name,char* attribute_value); xmlnode get_node_by_type(char* filename,char* type); xmlnode xmlNodePtr_to_xmlnode(void* pnode); void* xmlnode_to_xmlNodePtr(xmlnode* pnode); ! /*This returns the node's index, ! * which may be newly created. ! */ int write_xmlnode_to_tree(xmlnode node); #endif --- 86,109 ---- void* children; unsigned long num_children; ! } xmlnode; + /*! A constant representing the xmlnode equivalent of NULL */ const xmlnode nil_node = {0,0,0,ST_NONE,0,0,0,0,0,0,0,0,0}; + /*! Gets a node from the internal tree by its type (in the <>'s) and an attribute. */ xmlnode get_node_by_type_attrib(char* filename,char* type,char* attribute_name,char* attribute_value); + /*! Gets a node by its index. This is assigned just by counting in the order nodes are encountered in the tree, 1, 2, 3... */ xmlnode get_node_by_index(char* filename,unsigned long index); + /*! Gets a node by its content. */ xmlnode get_node_by_content(char* filename,int is_contents_complex,void* contents,unsigned long contents_size); + /*! Gets a node by a given attribute alone. */ xmlnode get_node_by_attribute(char* filename,char* attribute_name,char* attribute_value); + /*! Gets a node by its type alone. */ xmlnode get_node_by_type(char* filename,char* type); + /*! Converts a libxml2 xmlNodePtr into an xmlnode struct. */ xmlnode xmlNodePtr_to_xmlnode(void* pnode); + /*! Converts an xmlnode into its corresponding xmlNodePtr */ void* xmlnode_to_xmlNodePtr(xmlnode* pnode); ! /*! Writes the xmlnode to the internal node tree and returns the node's index, which may be newly created. */ int write_xmlnode_to_tree(xmlnode node); #endif |
|
From: nik_89 <ni...@us...> - 2004-12-29 00:10:38
|
Update of /cvsroot/xmltools/xmltools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7332 Modified Files: CMakeLists.txt README nmap.c xmltool.c xmltool.h Log Message: version : 0.5.2b xmltool.c and nmap.c : changed alot of stuff to make it compliant with the GNU Coding Standards. Added plenty of comments on both and cleaned the coding. fixed the README. things to do : -change the functions in nmap.c so they return pointers (expetially the static ones). -check out if it is GCS compliant. -add in error checking on allocating functions in nmap.c (GCS). -add nmap.c to the doxygen documentation. Index: README =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 25 Aug 2004 00:16:46 -0000 1.2 --- README 29 Dec 2004 00:10:26 -0000 1.3 *************** *** 1,3 **** ! xml-handler.c and xml-handler.h are both to be added to the source code of the projects that require easy input and output to xml databases. It requires the libxml2 library and the xml-utils. the compile FLAGS for this are : 'xml2-config --cflags' 'xml2-config --libs' --- 1,3 ---- ! xmltool.c and xmltool.h are both to be added to the source code of the projects that require easy input and output to xml databases. It requires the libxml2 library and the xml-utils. the compile FLAGS for this are : 'xml2-config --cflags' 'xml2-config --libs' *************** *** 9,20 **** # Makefile example : Begin ! BINARY=xml-handler FLAGS= -Wall -g `xml2-config --cflags` LIBS=`xml2-config --libs` ! OBJS= xml-handler.o GCC= gcc all: $(OBJS) ! $(GCC) $(FLAGS) $(LIBS) $(OBJS) -o xml-handler %.o: %.c %.h --- 9,20 ---- # Makefile example : Begin ! BINARY=xmltool FLAGS= -Wall -g `xml2-config --cflags` LIBS=`xml2-config --libs` ! OBJS= xmltool.o GCC= gcc all: $(OBJS) ! $(GCC) $(FLAGS) $(LIBS) $(OBJS) -o xmltool %.o: %.c %.h Index: nmap.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/nmap.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** nmap.c 26 Dec 2004 20:53:45 -0000 1.7 --- nmap.c 29 Dec 2004 00:10:26 -0000 1.8 *************** *** 29,33 **** * * TODO : convert all(almost) the integers returning to pointers and arguments ! * */ #include <stdio.h> --- 29,34 ---- * * TODO : convert all(almost) the integers returning to pointers and arguments ! * TODO : add checks to all the malloc, calloc and realloc function calls. ! */ #include <stdio.h> *************** *** 36,45 **** --- 37,63 ---- #include "xmltools.h" + /*--- function static prototypes ---*/ + static int give_parent_number(char *parent_name); static int give_child_number(char *parent_name, char *child_name); static int check_node_struct(char *parent_name, char *child_name); + static void clear_nmap(); + /*--- static variables ---*/ + /* this hold the current node + * map structure that was created + * using the Nmap_Add() function, + * it is altered using + * the Nmap_Edit(), Nmap_Del() and + * Nmap_Add() functions. + */ static NODE_MAP *n_map; + + /* carries the root name of n_map. + * it is assigned by Nmap_AddRoot + * and it is read by Nmap_Add() + * when creating the node map + */ static char *rootnam = NULL; *************** *** 47,51 **** ! int Nmap_AddRoot(char *rootname) { /*printf("will add the root (%s)\n", rootname); */ --- 65,70 ---- ! int ! Nmap_AddRoot(char *rootname) { /*printf("will add the root (%s)\n", rootname); */ *************** *** 75,79 **** } ! void Nmap_PrintData() { unsigned int a = 0; --- 94,102 ---- } ! /* a debug printing of the current n_map ! * structure. ! */ ! void ! Nmap_PrintData() { unsigned int a = 0; *************** *** 86,90 **** } ! char *Nmap_GetContent(char *child_name) { unsigned int a = 0; --- 109,115 ---- } ! /* returns the content of the child node . */ ! char * ! Nmap_GetContent(char *child_name) { unsigned int a = 0; *************** *** 107,111 **** } ! int Nmap_Add(char *parent_name, char *child_name, char *content) { /* error nums : --- 132,145 ---- } ! /* the most important function of this ! * source file. ! * Its use is to render the making of a ! * structure of nodes that will have to be ! * repeated very easy to do. check out the ! * description of this file above for some ! * other informations. ! */ ! int ! Nmap_Add(char *parent_name, char *child_name, char *content) { /* error nums : *************** *** 253,257 **** } ! int Nmap_Del(char *parent_name, char *child_name) { /* errors : 1 is that n_map doesnt exist, 2 if the parent doesnt exist, 3 if the child node doesnt exist (if the child node doesnt exist and theres no more nodes, it will delete it) */ unsigned int todel = 0, loo = 0, totalc = 0; --- 287,295 ---- } ! /* deletes a single node, in n_map, completely, including ! * content. ! */ ! int ! Nmap_Del(char *parent_name, char *child_name) { /* errors : 1 is that n_map doesnt exist, 2 if the parent doesnt exist, 3 if the child node doesnt exist (if the child node doesnt exist and theres no more nodes, it will delete it) */ unsigned int todel = 0, loo = 0, totalc = 0; *************** *** 274,278 **** return cnum; loo = cnum; ! #if old_del_method while (loo < n_map[pnum].total_child) { --- 312,316 ---- return cnum; loo = cnum; ! #if old_del_method while (loo < n_map[pnum].total_child) { *************** *** 323,327 **** loo++; } ! #else /* ok this is very simple yet it does the same and even better than the above * coding. (using pointers) */ --- 361,365 ---- loo++; } ! #else /* not use_old_method */ /* ok this is very simple yet it does the same and even better than the above * coding. (using pointers) */ *************** *** 368,372 **** break; } ! #endif loo = 0; --- 406,410 ---- break; } ! #endif /* not use_old_method */ loo = 0; *************** *** 419,447 **** } nodes_total--; ! #endif } return NO_ERROR; } ! void Nmap_Clear() { ! if (!n_map) ! { ! Xmltool_SetError(N_MAP_UNEXIST); ! return; ! } ! ! int a = 1 - 1; ! while (a >= 0) ! { ! while (n_map->total_child != 0) ! Nmap_Del(n_map->parent_name, n_map[a].child_nodes[0]); ! Nmap_Del(n_map->parent_name, NULL); ! a--; ! } ! } - void Nmap_ClearContent() - { if (!n_map) { --- 457,474 ---- } nodes_total--; ! #endif /* multi_parents */ } return NO_ERROR; } ! /* this function is to clear the content ! * for every nodes. char **child_content. ! */ ! void ! Nmap_ClearContent() { ! int a = 0; ! unsigned int b = 0; if (!n_map) { *************** *** 450,455 **** } - int a = 1 - 1; - unsigned int b = 0; while (a >= 0) { --- 477,480 ---- *************** *** 468,472 **** } ! NODE_MAP *Nmap_GetData() { return (NODE_MAP*)n_map; --- 493,501 ---- } ! /* this is to get the n_map struct ! * from the exterior of this source. ! */ ! NODE_MAP * ! Nmap_GetData() { return (NODE_MAP*)n_map; *************** *** 475,481 **** ! /* locals */ ! static char *give_parent_name(char *child_name) { if (!n_map) --- 504,512 ---- ! /*--- static functions ---*/ ! /* gives the name of the parent(not the root). */ ! static char * ! give_parent_name(char *child_name) { if (!n_map) *************** *** 503,508 **** } ! /* this function will be used to output the array number of the parent name string */ ! static int give_parent_number(char *parent_name) { if (!n_map) --- 534,544 ---- } ! /* this function is used ! * to output the array number ! * of the parent name string ! * TODO : return pointer ! */ ! static int ! give_parent_number(char *parent_name) { if (!n_map) *************** *** 528,532 **** } ! static int give_child_number(char *parent_name, char *child_name) { --- 564,570 ---- } ! /* TODO : return pointer */ ! static int ! give_child_number(char *parent_name, char *child_name) { *************** *** 557,563 **** } ! /* this functions will be used to know if the current parent_node already has a node with the name ! to put in it. will return 0 if its not existant and 1 if it is. */ ! static int check_node_struct(char *parent_name, char *child_name) { --- 595,606 ---- } ! /* this functions is used to know ! * if the current parent_node already ! * has a node with the name ! * to put in it. will return 0 if ! * its not existant and 1 if it is. ! */ ! static int ! check_node_struct(char *parent_name, char *child_name) { *************** *** 587,595 **** } ! /* allocators/deallocators */ ! void Nmap_Clean() { ! Nmap_Clear(); return; } --- 630,663 ---- } ! /* this function calls Nmap_Del() for ! * every elements of n_map until ! * it is completely empty. ! */ ! static void ! clear_nmap() ! { ! if (!n_map) ! { ! Xmltool_SetError(N_MAP_UNEXIST); ! return; ! } ! ! int a = 1 - 1; ! while (a >= 0) ! { ! while (n_map->total_child != 0) ! Nmap_Del(n_map->parent_name, n_map[a].child_nodes[0]); ! Nmap_Del(n_map->parent_name, NULL); ! a--; ! } ! } ! ! /*--- allocators/deallocators ---*/ ! ! void ! Nmap_Clean() { ! clear_nmap(); return; } Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/CMakeLists.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CMakeLists.txt 26 Dec 2004 20:53:44 -0000 1.9 --- CMakeLists.txt 29 Dec 2004 00:10:26 -0000 1.10 *************** *** 5,9 **** # set the version define for the project ! SET_TARGET_PROPERTIES(XMLTOOLS_SRC PROPERTIES VERSION "0.5.0b") # show all errors and warnings and add special infos to be used with gdb --- 5,9 ---- # set the version define for the project ! SET_TARGET_PROPERTIES(XMLTOOLS_SRC PROPERTIES VERSION "0.5.2b") # show all errors and warnings and add special infos to be used with gdb Index: xmltool.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xmltool.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** xmltool.c 26 Dec 2004 20:53:45 -0000 1.6 --- xmltool.c 29 Dec 2004 00:10:26 -0000 1.7 *************** *** 26,33 **** */ #define error_handle(error) xmlt_errno = error; return error #define error_handle2(error) xmlt_errno = error; return NULL ! /* extern */ #include <libxml/tree.h> #include <libxml/parser.h> --- 26,36 ---- */ + /* those are to set the errors. + * to be used in the functions. */ #define error_handle(error) xmlt_errno = error; return error #define error_handle2(error) xmlt_errno = error; return NULL ! /*--- extern ---*/ ! #include <libxml/tree.h> #include <libxml/parser.h> *************** *** 37,43 **** #include <stdio.h> ! /* local */ #include "xmltools.h" static const char *xmltools_errors_string[] = { --- 40,54 ---- #include <stdio.h> ! /*--- local ---*/ ! #include "xmltools.h" + + /*--- static variables ---*/ + + /* Used by Xmltool_Perror to have + * a small sentence explaining what + * is the error. + */ static const char *xmltools_errors_string[] = { *************** *** 53,80 **** }; static int xmlt_errno; static xmlBufferPtr createdtdheader(xmlDocPtr doc, xmlChar **buf1); static void freedtdheader(xmlBufferPtr buf, xmlChar **buf1); - static xmlNodePtr *findNode(xmlDocPtr *doc, char *parent_name, char *child_name, char *content); #define usexmlbuffer 0 - /* Externally accessable functions */ ! /* prints the error description */ ! void Xmltool_GetError(int *destination) { *destination = xmlt_errno; } ! void Xmltool_SetError(int source) { xmlt_errno = source; } ! void Xmltool_Perror(char *message) { int err = xmlt_errno; --- 64,111 ---- }; + /* keeps the current error signaled. + * It is passed to the argument + * in Xmltool_GetError or Xmltool_Perror. + * To change the variable + * from the exterior, use Xmltool_SetError. + */ static int xmlt_errno; + + /*--- function static prototypes ---*/ + static xmlBufferPtr createdtdheader(xmlDocPtr doc, xmlChar **buf1); static void freedtdheader(xmlBufferPtr buf, xmlChar **buf1); static xmlNodePtr *findNode(xmlDocPtr *doc, char *parent_name, char *child_name, char *content); + + + /*--- defines ---*/ + + /* this was to set which + * version of the allocations is to be + * used in the dtd making process. + */ #define usexmlbuffer 0 ! /*--- Externally accessable functions ---*/ ! ! /* prints the error description */ ! void ! Xmltool_GetError(int *destination) { *destination = xmlt_errno; } ! void ! Xmltool_SetError(int source) { xmlt_errno = source; } ! void ! Xmltool_Perror(char *message) { int err = xmlt_errno; *************** *** 84,88 **** } ! int Xmltool_WriteToXml(char *filename, char *parent_name, char *node_name, char *node_info) { xmlDocPtr doc; --- 115,120 ---- } ! int ! Xmltool_WriteToXml(char *filename, char *parent_name, char *node_name, char *node_info) { xmlDocPtr doc; *************** *** 160,164 **** } ! char *Xmltool_ReadFromXml(char *filename, char *parent_name, char *child_name) { /* might have to output the data --- 192,197 ---- } ! char * ! Xmltool_ReadFromXml(char *filename, char *parent_name, char *child_name) { /* might have to output the data *************** *** 184,188 **** } ! int Xmltool_EditToXml(char *filename, char *parent_name, char *child_name, char *content) {/* simply changes the content of the given node to the new one inputted. */ xmlDocPtr doc; --- 217,222 ---- } ! int ! Xmltool_EditToXml(char *filename, char *parent_name, char *child_name, char *content) {/* simply changes the content of the given node to the new one inputted. */ xmlDocPtr doc; *************** *** 212,216 **** } ! int Xmltool_RemoveFromXml(char *filename, char *parent_name, char *child_name) { /* remove the node of a parent, if the node is NULL or inexistant, remove the whole content of the parent or simply remove the empty parent node, in order. */ --- 246,251 ---- } ! int ! Xmltool_RemoveFromXml(char *filename, char *parent_name, char *child_name) { /* remove the node of a parent, if the node is NULL or inexistant, remove the whole content of the parent or simply remove the empty parent node, in order. */ *************** *** 239,243 **** } ! int Xmltool_GetXmlDesc(char *filename) { if (open(filename, 0644) == -1) /* check to see if the file exist */ --- 274,279 ---- } ! int ! Xmltool_GetXmlDesc(char *filename) { if (open(filename, 0644) == -1) /* check to see if the file exist */ *************** *** 285,289 **** } ! int Xmltool_MAddXml(char *filename) { xmlDocPtr doc; --- 321,326 ---- } ! int ! Xmltool_MAddXml(char *filename) { xmlDocPtr doc; *************** *** 364,368 **** } ! NODE_MAP *Xmltool_MReadXml(char *filename, char *parent_name, char *node_name, char *content) { /* This function will check out the nodes in order until --- 401,406 ---- } ! NODE_MAP * ! Xmltool_MReadXml(char *filename, char *parent_name, char *node_name, char *content) { /* This function will check out the nodes in order until *************** *** 441,447 **** } ! /* local */ ! static xmlBufferPtr createdtdheader(xmlDocPtr doc, xmlChar **buf1) { xmlChar *elem = "<!ELEMENT "; --- 479,486 ---- } ! /*--- static functions ---*/ ! static xmlBufferPtr ! createdtdheader(xmlDocPtr doc, xmlChar **buf1) { xmlChar *elem = "<!ELEMENT "; *************** *** 500,511 **** *buf1 = (xmlChar*)xmlBufferContent(buf); return buf; ! #else unsigned int a = 0; char *tmp1 = calloc(1, 512); ! printf("will now use the 2nd way of doing the dtd header\n"); sprintf(tmp1, "%s [\n%s%s ANY>", doc->children->name, elem, doc->children->name); ! printf("here1\n"); sprintf(tmp1, "%s%s%s (", tmp1, elem, n_map->parent_name); ! printf("here2\n"); while (a < n_map->total_child - 1) { --- 539,558 ---- *buf1 = (xmlChar*)xmlBufferContent(buf); return buf; ! #else /* not usexmlbuffer */ unsigned int a = 0; + + /* the buffer is 512 until I make it dynamic + * FIXME : make it dynamic + */ char *tmp1 = calloc(1, 512); ! if (tmp1 == NULL) ! { ! perror("createdtdheader():line#547:xmltool.c"); ! } ! /* printf("will now use the 2nd way of doing the dtd header\n"); */ sprintf(tmp1, "%s [\n%s%s ANY>", doc->children->name, elem, doc->children->name); ! /* printf("here1\n"); */ sprintf(tmp1, "%s%s%s (", tmp1, elem, n_map->parent_name); ! /* printf("here2\n"); */ while (a < n_map->total_child - 1) { *************** *** 521,540 **** } sprintf(tmp1, "%s]", tmp1); ! printf("createdtdheader temp1 %s\n", tmp1); *buf1 = tmp1; return NULL; ! #endif } ! static void freedtdheader(xmlBufferPtr buf, xmlChar **buf1) { #if usexmlbuffer xmlBufferFree(buf); ! #else ! /* *buf1 = realloc(buf1, 0); */ ! #endif } ! static xmlNodePtr *findNode(xmlDocPtr *doc, char *parent_name, char *child_name, char *content) { /* this functions will be smaller when --- 568,590 ---- } sprintf(tmp1, "%s]", tmp1); ! /* printf("createdtdheader temp1 %s\n", tmp1); */ *buf1 = tmp1; return NULL; ! #endif /* not usexmlbuffer */ } ! static void ! freedtdheader(xmlBufferPtr buf, xmlChar **buf1) { #if usexmlbuffer xmlBufferFree(buf); ! #else /* not usexmlbuffer */ ! free(buf); ! buf = NULL; ! #endif /* not usexmlbuffer */ } ! static xmlNodePtr * ! findNode(xmlDocPtr *doc, char *parent_name, char *child_name, char *content) { /* this functions will be smaller when *************** *** 570,574 **** else printf("incorrect match (%s) (%s %s)\n", cur->name, content, xmlNodeListGetString(*doc, cur->children, 1)); ! #endif } else --- 620,624 ---- else printf("incorrect match (%s) (%s %s)\n", cur->name, content, xmlNodeListGetString(*doc, cur->children, 1)); ! #endif /* debug */ } else *************** *** 631,637 **** } ! /* desctructor / creator */ ! void Xmltool_Clean() { Nmap_Clean(); --- 681,688 ---- } ! /*--- destructor / creator ---*/ ! void ! Xmltool_Clean() { Nmap_Clean(); Index: xmltool.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xmltool.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** xmltool.h 26 Dec 2004 20:53:45 -0000 1.7 --- xmltool.h 29 Dec 2004 00:10:26 -0000 1.8 *************** *** 100,104 **** /*! Modify a single value of a node */ extern int Xmltool_EditToXml( ! /* the xml file */ char *filename, /*! parent node of the node */ --- 100,104 ---- /*! Modify a single value of a node */ extern int Xmltool_EditToXml( ! /*! the xml file */ char *filename, /*! parent node of the node */ |
|
From: nik_89 <ni...@us...> - 2004-12-26 20:54:12
|
Update of /cvsroot/xmltools/xmltools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10749 Modified Files: CMakeLists.txt INSTALL license_template.txt misc.c misc.h nmap.c nmap.h xml-advhandler.c xml-advhandler.h xmltool.c xmltool.h xmltools.h Log Message: Changed license informations -> Lesser GNU Public License Index: nmap.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/nmap.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nmap.h 1 Nov 2004 17:56:24 -0000 1.4 --- nmap.h 26 Dec 2004 20:53:45 -0000 1.5 *************** *** 1,5 **** --- 1,30 ---- + /* Xmltools project. + * The xml tool project provides developers functions that uses the libxml2 library. + * It provides an easy way to input and output configurations from/to xml files + * and handlers to deal with small or big xml databases. + * Copyright (C) 2004 Nicholas Niro + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef __NMAP_H #define __NMAP_H + /* nmap.h + * node map for multiple node processing + */ + + /* this struct will be used to know * how many and by what name Index: xmltool.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xmltool.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xmltool.c 24 Dec 2004 22:12:42 -0000 1.5 --- xmltool.c 26 Dec 2004 20:53:45 -0000 1.6 *************** *** 1,15 **** ! /* Copyright (C) 2004 to its developers, see AUTHORS for a list ! This file is part of the xmltools project. - The xmltools project is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - The xmltools project is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - */ /*! * xmltool.c --- 1,24 ---- ! /* Xmltools project. ! * The xml tool project provides developers functions that uses the libxml2 library. ! * It provides an easy way to input and output configurations from/to xml files ! * and handlers to deal with small or big xml databases. ! * Copyright (C) 2004 Nicholas Niro ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ /*! * xmltool.c Index: misc.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/misc.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** misc.c 26 Oct 2004 04:50:49 -0000 1.9 --- misc.c 26 Dec 2004 20:53:45 -0000 1.10 *************** *** 1,15 **** ! /* Copyright (C) 2004 to its developers, see AUTHORS for a list ! This file is part of the xmltools project. ! ! The xmltools project is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! ! The xmltools project is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! General Public License for more details. ! */ /* misc.c --- 1,22 ---- ! /* Xmltools project. ! * The xml tool project provides developers functions that uses the libxml2 library. ! * It provides an easy way to input and output configurations from/to xml files ! * and handlers to deal with small or big xml databases. ! * Copyright (C) 2004 Nicholas Niro ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ /* misc.c Index: xml-advhandler.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xml-advhandler.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xml-advhandler.c 26 Oct 2004 01:01:23 -0000 1.2 --- xml-advhandler.c 26 Dec 2004 20:53:45 -0000 1.3 *************** *** 1,2 **** --- 1,23 ---- + /* Xmltools project. + * The xml tool project provides developers functions that uses the libxml2 library. + * It provides an easy way to input and output configurations from/to xml files + * and handlers to deal with small or big xml databases. + * Copyright (C) 2004 Nicholas Niro + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "xml-advhandler.h" Index: xml-advhandler.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xml-advhandler.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** xml-advhandler.h 24 Oct 2004 20:07:22 -0000 1.1 --- xml-advhandler.h 26 Dec 2004 20:53:45 -0000 1.2 *************** *** 1,2 **** --- 1,24 ---- + /* Xmltools project. + * The xml tool project provides developers functions that uses the libxml2 library. + * It provides an easy way to input and output configurations from/to xml files + * and handlers to deal with small or big xml databases. + * Copyright (C) 2004 Nicholas Niro + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + #ifndef __XML_ADVHANDLER_H #define __XML_ADVHANDLER_H Index: misc.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/misc.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** misc.h 24 Oct 2004 20:07:22 -0000 1.7 --- misc.h 26 Dec 2004 20:53:45 -0000 1.8 *************** *** 1,15 **** ! /* Copyright (C) 2004 to its developers, see AUTHORS for a list ! This file is part of the xmltools project. ! ! The xmltools project is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! ! The xmltools project is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! General Public License for more details. ! */ /* misc.h */ --- 1,22 ---- ! /* Xmltools project. ! * The xml tool project provides developers functions that uses the libxml2 library. ! * It provides an easy way to input and output configurations from/to xml files ! * and handlers to deal with small or big xml databases. ! * Copyright (C) 2004 Nicholas Niro ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ /* misc.h */ Index: license_template.txt =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/license_template.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsbA544l and /tmp/cvs4MoNq8 differ Index: xmltool.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xmltool.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** xmltool.h 26 Dec 2004 08:05:22 -0000 1.6 --- xmltool.h 26 Dec 2004 20:53:45 -0000 1.7 *************** *** 1,15 **** ! /* Copyright (C) 2004 to its developers, see AUTHORS for a list ! This file is part of the xmltools project. ! ! The xmltools project is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. ! ! The xmltools project is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! General Public License for more details. ! */ --- 1,22 ---- ! /* Xmltools project. ! * The xml tool project provides developers functions that uses the libxml2 library. ! * It provides an easy way to input and output configurations from/to xml files ! * and handlers to deal with small or big xml databases. ! * Copyright (C) 2004 Nicholas Niro ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ Index: xmltools.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xmltools.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** xmltools.h 26 Dec 2004 08:05:22 -0000 1.3 --- xmltools.h 26 Dec 2004 20:53:45 -0000 1.4 *************** *** 1,5 **** --- 1,30 ---- + /* Xmltools project. + * The xml tool project provides developers functions that uses the libxml2 library. + * It provides an easy way to input and output configurations from/to xml files + * and handlers to deal with small or big xml databases. + * Copyright (C) 2004 Nicholas Niro + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + /* xmltools.h main global header file + */ + #ifndef __XMLTOOLS_H #define __XMLTOOLS_H + /* keep it at 0 since the advhandler module isn't working properly yet. */ #define advanced 0 Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/CMakeLists.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CMakeLists.txt 26 Dec 2004 08:05:20 -0000 1.8 --- CMakeLists.txt 26 Dec 2004 20:53:44 -0000 1.9 *************** *** 5,9 **** # set the version define for the project ! SET_TARGET_PROPERTIES(XMLTOOLS_SRC PROPERTIES VERSION "0.5b") # show all errors and warnings and add special infos to be used with gdb --- 5,9 ---- # set the version define for the project ! SET_TARGET_PROPERTIES(XMLTOOLS_SRC PROPERTIES VERSION "0.5.0b") # show all errors and warnings and add special infos to be used with gdb Index: INSTALL =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/INSTALL,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** INSTALL 26 Dec 2004 01:22:15 -0000 1.1 --- INSTALL 26 Dec 2004 20:53:45 -0000 1.2 *************** *** 4,7 **** --- 4,12 ---- CMake works on both windows and POSIX OSes while autoconf only works on POSIX OSes. + + + cmake link : www.cmake.org + + Compiling Xmltools : *************** *** 10,22 **** type "make" which will compile Xmltools. ! Result : It will create a shared object .so file and also an include directory. Including the Xmltools library in your project : ! IMPORTANT : don't forget to also include the libxml2 library in your compiling(the binary to it is included in the include directory). Theres several ways to include Xmltools to your project and I will try to cover as much ! as possible. - Copy libxmltools.so to /usr/lib or /lib as root and compile with the flags -lxmltools --- 15,31 ---- type "make" which will compile Xmltools. ! Result : It will create a shared object .so file and also a folder(xmltools) in ! the include directory. Including the Xmltools library in your project : ! IMPORTANT : don't forget to also include the libxml2 library in your compiling(it is included in the include directory). Theres several ways to include Xmltools to your project and I will try to cover as much ! as possible. ! ! --- Copy the include directory to your project, it contains all the header files needed. ! Also copy the lib directory to your project, it contains all the libxml2 and such libraries. -- - Copy libxmltools.so to /usr/lib or /lib as root and compile with the flags -lxmltools Index: nmap.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/nmap.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** nmap.c 24 Dec 2004 22:12:42 -0000 1.6 --- nmap.c 26 Dec 2004 20:53:45 -0000 1.7 *************** *** 1,15 **** ! /* Copyright (C) 2004 to its developers, see AUTHORS for a list ! This file is part of the xmltools project. ! ! The xmltools project is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public ! License as published by the Free Software Foundation; either ! version 2.1 of the License, or (at your option) any later version. - The xmltools project is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - */ /* nmap.c * --- 1,23 ---- ! /* Xmltools project. ! * The xml tool project provides developers functions that uses the libxml2 library. ! * It provides an easy way to input and output configurations from/to xml files ! * and handlers to deal with small or big xml databases. ! * Copyright (C) 2004 Nicholas Niro ! * ! * This library is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public ! * License as published by the Free Software Foundation; either ! * version 2.1 of the License, or (at your option) any later version. ! * ! * This library is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! * Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public ! * License along with this library; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ /* nmap.c * |
|
From: nik_89 <ni...@us...> - 2004-12-26 20:11:27
|
Update of /cvsroot/xmltools/xmltools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2478 Added Files: license.txt license_template.txt Log Message: license related files --- NEW FILE: license.txt --- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! --- NEW FILE: license_template.txt --- (This appears to be a binary file; contents omitted.) |
|
From: nik_89 <ni...@us...> - 2004-12-26 08:05:37
|
Update of /cvsroot/xmltools/xmltools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4687 Modified Files: CMakeLists.txt xmltool.h xmltools.h Removed Files: mcd.c mcd.h Log Message: version 0.5b removed unused sources : mcd.c mcd.h CMakeLists.txt : removed the mcd compiling. xmltool.h : major documentation work, compatible with Doxygen. Index: xmltools.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xmltools.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xmltools.h 1 Nov 2004 17:56:24 -0000 1.2 --- xmltools.h 26 Dec 2004 08:05:22 -0000 1.3 *************** *** 3,7 **** #define advanced 0 - #define _MCD_CHECK #include <stdio.h> --- 3,6 ---- *************** *** 13,19 **** #include "xml-advhandler.h" #endif - #ifdef _MCD_CHECK - #include "mcd.h" - #endif #endif --- 12,15 ---- Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/CMakeLists.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CMakeLists.txt 26 Dec 2004 01:22:15 -0000 1.7 --- CMakeLists.txt 26 Dec 2004 08:05:20 -0000 1.8 *************** *** 2,6 **** # specification file to generate the Makefile PROJECT (XMLTOOLS C) ! SET (XMLTOOLS_SRC nmap.c misc.c xmltool.c mcd.c) # set the version define for the project --- 2,6 ---- # specification file to generate the Makefile PROJECT (XMLTOOLS C) ! SET (XMLTOOLS_SRC nmap.c misc.c xmltool.c) # set the version define for the project --- mcd.c DELETED --- Index: xmltool.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xmltool.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xmltool.h 1 Nov 2004 17:56:24 -0000 1.5 --- xmltool.h 26 Dec 2004 08:05:22 -0000 1.6 *************** *** 14,25 **** ! /* xmltool.h ! * ! * */ #ifndef __XMLTOOL_H #define __XMLTOOL_H ! enum { N_MAP_UNEXIST= -4, --- 14,29 ---- ! /*! \file xmltool.h ! * \brief the xmltools core main header. ! * ! * This file contains the main functions used for xml handling. */ #ifndef __XMLTOOL_H #define __XMLTOOL_H ! /*! ! * Sets the error types returned by the functions ! * */ ! enum returns { N_MAP_UNEXIST= -4, *************** *** 34,38 **** }; ! /* Basic functions prototypes below * * Made by Nik_89 --- 38,42 ---- }; ! /* Basic function prototypes below * * Made by Nik_89 *************** *** 40,100 **** ! /* prints the error description. This functions has to be used to be given a short description of an eventual error. */ ! extern void Xmltool_Perror(char *message /* this is for the user to add extra informations (like the function name it was called from).*/); ! /* FIXME */ ! void Xmltool_SetError(int source /* FIXME */); ! /* FIXME */ ! void Xmltool_GetError(int *destination /* FIXME */); ! /* set of functions to Input, Output, Edit and Delete to the xml file. They are used to add, edit, read and remove only 1 item at a time. ! */ ! /* Simple xml node writer. This function can be used to write single nodes to an xml file. */ ! extern int Xmltool_WriteToXml(char *filename, /* filename to write to */ ! char *parent_name, /* name of the parent node */ ! char *node_name, /* name of the child node to write to */ ! char *node_info); /* data to add to the child node */ ! /* FIXME */ ! extern char *Xmltool_ReadFromXml(char *filename, /* filename to read from */ ! char *parent_name, /* name of the parent node */ ! char *child_name); /* name of the child node to read from */ ! /* FIXME */ ! extern int Xmltool_EditToXml(char *filename, /* FIXME */ ! char *parent_name, /* FIXME */ ! char *node_name, /* FIXME */ ! char *node_info); /* FIXME */ ! /* FIXME */ ! extern int Xmltool_RemoveFromXml(char *filename, /* FIXME */ ! char *parent_name, /* FIXME */ ! char *child_name); /* FIXME */ ! /* set of functions to Input, * Output, Edit and Delete to the xml file. * They are used to add, edit, read and remove * as many nodes as there is in the n_map struct. * ! * the Edit and Delete functions arent done yet */ ! /* FIXME */ ! extern int Xmltool_GetXmlDesc(char *filename /* FIXME */); ! /* FIXME */ ! extern int Xmltool_MAddXml(char *filename /* FIXME */); ! /* FIXME */ ! extern struct node_map *Xmltool_MReadXml(char *filename,/* filename to read from */ ! char *parent_node, /* name of the parent node */ ! char *node_name, /* name of the child that has unique data */ ! char *content); /* content that the child ! * must have to be recognised ! */ ! /* FIXME */ extern void Xmltool_Clean(); --- 44,148 ---- ! /*! prints the error description. ! * This functions has to be used to ! * be given a short description ! * of an eventual error. ! */ ! extern void Xmltool_Perror( ! /*! this is for the user to add extra ! * informations (like the function name it was called from). ! */ ! char *message ); ! /*! Internal, do not use. The name is self explanatory anyway.*/ ! void Xmltool_SetError( ! /*! the error number */ ! int source); ! /*! FIXME */ ! void Xmltool_GetError( ! /*! FIXME */ ! int *destination); ! /* set of functions to Input, ! * Output, Edit and Delete to the xml file. ! * They are used to add, edit, read ! * and remove only 1 item at a time. ! */ ! /*! Write a single value to a node */ ! extern int Xmltool_WriteToXml( ! /*! xml file */ ! char *filename, ! /*! parent node of the node */ ! char *parent_name, ! /*! node to add */ ! char *node_name, ! /*! data to add to the node */ ! char *node_info); ! /*! Read a single value of a node */ ! extern char *Xmltool_ReadFromXml( ! /*! the xml file */ ! char *filename, ! /*! parent node of the node */ ! char *parent_name, ! /*! node to read */ ! char *child_name); ! /*! Modify a single value of a node */ ! extern int Xmltool_EditToXml( ! /* the xml file */ ! char *filename, ! /*! parent node of the node */ ! char *parent_name, ! /*! node to edit */ ! char *node_name, ! /*! New data to add to the node */ ! char *node_info); ! /*! Delete a single node */ ! extern int Xmltool_RemoveFromXml( ! /*! the xml file */ ! char *filename, ! /*! parent node of the node */ ! char *parent_name, ! /*! the node to delete */ ! char *child_name); ! /* ! * set of functions to Input, * Output, Edit and Delete to the xml file. * They are used to add, edit, read and remove * as many nodes as there is in the n_map struct. * ! * FIXME : the Edit and Delete functions aren't done yet */ ! /*! This function actually checks and parse the DtD of an xml file.*/ ! extern int Xmltool_GetXmlDesc( ! /*! file to read from */ ! char *filename ); ! /*! This function is to dump the data loaded, with Nmap_Add, in the xml file. */ ! extern int Xmltool_MAddXml( ! /*! file to write to */ ! char *filename ); ! /*! Reads a file that has a repetitive number of parent nodes (as set in the DtD). */ ! extern struct node_map *Xmltool_MReadXml( ! /*! the xml file. */ ! char *filename, ! /*! parent node of the node. */ ! char *parent_node, ! /*! node that has a unique data(compared to the other nodes) */ ! char *node_name, ! /*! content that the child ! * must have to be recognised ! */ ! char *content); ! ! /*! clean up Xmltools. Call this before the program closes, at least. */ extern void Xmltool_Clean(); --- mcd.h DELETED --- |
|
From: nik_89 <ni...@us...> - 2004-12-26 01:22:25
|
Update of /cvsroot/xmltools/xmltools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6099 Modified Files: CMakeLists.txt Added Files: INSTALL Log Message: added the file INSTALL : instructions on how to install and compile with xmltools (quality insurance) CMakeLists.txt : added a versionning set that probably don't work. Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/CMakeLists.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CMakeLists.txt 1 Nov 2004 18:36:57 -0000 1.6 --- CMakeLists.txt 26 Dec 2004 01:22:15 -0000 1.7 *************** *** 4,8 **** SET (XMLTOOLS_SRC nmap.c misc.c xmltool.c mcd.c) ! ADD_DEFINITIONS( -W -g ) # show all errors and warnings and add special infos to be used with gdb # set the directory where to find libraries --- 4,12 ---- SET (XMLTOOLS_SRC nmap.c misc.c xmltool.c mcd.c) ! # set the version define for the project ! SET_TARGET_PROPERTIES(XMLTOOLS_SRC PROPERTIES VERSION "0.5b") ! ! # show all errors and warnings and add special infos to be used with gdb ! ADD_DEFINITIONS( -W -g ) # set the directory where to find libraries *************** *** 18,24 **** # until I decide to fix txml.c to the new functions - # LINK_LIBRARIES (xmltools) - # ADD_EXECUTABLE (test_lib txml.c) --- 22,26 ---- --- NEW FILE: INSTALL --- First of all : Xmltools aims developer users. The Xmltools project uses the Cmake program that is an alternative to autoconf. CMake works on both windows and POSIX OSes while autoconf only works on POSIX OSes. Compiling Xmltools : - download Cmake for your OS, install Cmake and type "cmake ." including the dot. - Now, in the Xmltools directory, when Cmake finished generating the Makefile, type "make" which will compile Xmltools. Result : It will create a shared object .so file and also an include directory. Including the Xmltools library in your project : IMPORTANT : don't forget to also include the libxml2 library in your compiling(the binary to it is included in the include directory). Theres several ways to include Xmltools to your project and I will try to cover as much as possible. - Copy libxmltools.so to /usr/lib or /lib as root and compile with the flags -lxmltools - Have a lib directory in your home directory amd have the -I option point to it. example : -I/home/myuser/lib -lxmltools. I hope that you will find this library useful, the Xmltools team. |
|
From: Nik F. <nik...@ya...> - 2004-12-25 15:01:13
|
I have recently fixed plenty of bugs and im awaiting tests to see if theres some more out there. If theres not much bugs, I will release the project as beta version 1.0b . -Nik_89 ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca |
|
From: nik_89 <ni...@us...> - 2004-12-24 22:12:53
|
Update of /cvsroot/xmltools/xmltools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30651 Modified Files: mcd.h nmap.c xmltool.c Log Message: nmap.c xmltool.c : Major bug fixes on those 2, it actually works very well for me. We will do some tests and release it if theres no more bugs. Index: nmap.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/nmap.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** nmap.c 1 Nov 2004 17:56:24 -0000 1.5 --- nmap.c 24 Dec 2004 22:12:42 -0000 1.6 *************** *** 19,22 **** --- 19,24 ---- * node at a time (a set of nodes to be * duplicated with different content). + * + * TODO : convert all(almost) the integers returning to pointers and arguments * */ *************** *** 55,59 **** } if (!n_map) ! rootnam = rootname; return 0; } --- 57,67 ---- } if (!n_map) ! { ! if (!rootnam) ! rootnam = calloc(1, strlen(rootname)); ! else ! rootnam = realloc(rootnam, strlen(rootname)); ! memcpy(rootnam, rootname, strlen(rootname)); ! } return 0; } *************** *** 118,121 **** --- 126,131 ---- if (!rootnam) Nmap_AddRoot("_xml_root_"); + else + rootnam = realloc(rootnam, 0); } else *************** *** 237,261 **** int Nmap_Del(char *parent_name, char *child_name) { /* errors : 1 is that n_map doesnt exist, 2 if the parent doesnt exist, 3 if the child node doesnt exist (if the child node doesnt exist and theres no more nodes, it will delete it) */ if (!n_map) return N_MAP_UNEXIST; ! int o_checknode = check_node_struct(parent_name, child_name); if ( o_checknode == PARENT_UNEXIST) return o_checknode; ! int pnum = give_parent_number(parent_name); if (pnum == PARENT_UNEXIST) return pnum; ! if (o_checknode == 1 && n_map[pnum].total_child > 0) { ! int cnum = give_child_number(parent_name, child_name); if (cnum == CHILD_UNEXIST) return cnum; ! unsigned int loo = cnum; while (loo < n_map[pnum].total_child) { printf("nmap_del : loo %d\n", loo); unsigned int slen = strlen(n_map[pnum].child_nodes[loo + 1]) + 1; ! /* for the content */ unsigned int c_slen = strlen(n_map[pnum].child_content[loo + 1]) + 1; --- 247,276 ---- int Nmap_Del(char *parent_name, char *child_name) { /* errors : 1 is that n_map doesnt exist, 2 if the parent doesnt exist, 3 if the child node doesnt exist (if the child node doesnt exist and theres no more nodes, it will delete it) */ + unsigned int todel = 0, loo = 0, totalc = 0; + int o_checknode = 0, pnum = 0, cnum = 0; + if (!n_map) return N_MAP_UNEXIST; ! o_checknode = check_node_struct(parent_name, child_name); if ( o_checknode == PARENT_UNEXIST) return o_checknode; ! pnum = give_parent_number(parent_name); if (pnum == PARENT_UNEXIST) return pnum; ! if (o_checknode == 1 && n_map[pnum].total_child > 0) { ! cnum = give_child_number(parent_name, child_name); if (cnum == CHILD_UNEXIST) return cnum; ! loo = cnum; ! #if old_del_method while (loo < n_map[pnum].total_child) { printf("nmap_del : loo %d\n", loo); unsigned int slen = strlen(n_map[pnum].child_nodes[loo + 1]) + 1; ! /* will have to assign the last ! * entry to the current pointer(pointer to delete) */ /* for the content */ unsigned int c_slen = strlen(n_map[pnum].child_content[loo + 1]) + 1; *************** *** 266,269 **** --- 281,287 ---- n_map[pnum].child_content[loo] = (char*)realloc(n_map->child_content[loo], c_slen); + /* this is stupid and newb... we only need to set the pointer heh + * the worse would be to have to set the pointers of all after the + * one to delete. */ memcpy(n_map[pnum].child_nodes[loo], n_map[pnum].child_nodes[loo + 1], slen); memcpy(n_map[pnum].child_content[loo], n_map[pnum].child_content[loo + 1], c_slen); *************** *** 297,307 **** loo++; } loo = 0; ! while (loo < n_map->total_child - 1) { printf("nmap_del : list %s\n", n_map->child_nodes[loo]); loo++; } ! n_map->total_child--; } --- 315,373 ---- loo++; } + #else + /* ok this is very simple yet it does the same and even better than the above + * coding. (using pointers) */ + while (1 != 2) + { + todel = give_child_number(parent_name, child_name); + if (n_map->total_child == 1) + { /* we just delete the entry without doing anything else */ + printf("Nmap_del : only one left to del \n"); + free(n_map->child_nodes[todel]); + free(n_map->child_content[todel]); + free(n_map->child_nodes); + free(n_map->child_content); + n_map->total_child--; + } + else if (n_map->total_child == todel) + { /* we just delete the entry and realloc the node and content pointers */ + printf("Nmap_del : deleting the last one of the list\n"); + free(n_map->child_nodes[todel]); + free(n_map->child_content[todel]); + n_map->total_child--; + /* realloc the node and content ptp */ + n_map->child_nodes = (char**)realloc(n_map->child_nodes, sizeof(char*) * (n_map->total_child)); + n_map->child_content = (char**)realloc(n_map->child_content, sizeof(char*) * (n_map->total_child)); + + } + else + { + printf("Nmap_del : normal deleting part\n"); + /* free the data of the current node and content */ + free(n_map->child_nodes[todel]); + free(n_map->child_content[todel]); + /* pass the end content and node to the freed pointers */ + n_map->child_nodes[todel] = NULL; + n_map->child_content[todel] = NULL; + n_map->child_nodes[todel] = n_map->child_nodes[n_map->total_child - 1]; + n_map->child_content[todel] = n_map->child_content[n_map->total_child - 1]; + /* substract the nodes and content total */ + n_map->total_child--; + /* realloc the node and content ptp */ + n_map->child_nodes = (char**)realloc(n_map->child_nodes, sizeof(char*) * (n_map->total_child)); + n_map->child_content = (char**)realloc(n_map->child_content, sizeof(char*) * (n_map->total_child)); + } + break; + } + #endif loo = 0; ! ! while (loo < n_map->total_child) { printf("nmap_del : list %s\n", n_map->child_nodes[loo]); loo++; } ! /* n_map->total_child--; */ ! } *************** *** 315,318 **** --- 381,386 ---- free(n_map->root_name); free(n_map->parent_name); + n_map->root_name = NULL; + n_map->parent_name = NULL; /* now done above free(n_map->child_nodes); *************** *** 321,325 **** /* n_map = realloc(n_map, 0); */ free(n_map); ! #if multi_parents if (nodes_total > 0) --- 389,393 ---- /* n_map = realloc(n_map, 0); */ free(n_map); ! n_map = NULL; #if multi_parents if (nodes_total > 0) Index: xmltool.c =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/xmltool.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** xmltool.c 1 Nov 2004 17:56:24 -0000 1.4 --- xmltool.c 24 Dec 2004 22:12:42 -0000 1.5 *************** *** 12,20 **** General Public License for more details. */ ! /* xmltool.c ! * * the basic xml functions for the project xmltools are here */ /* extern */ #include <libxml/tree.h> --- 12,23 ---- General Public License for more details. */ ! /*! ! * xmltool.c * the basic xml functions for the project xmltools are here */ + #define error_handle(error) xmlt_errno = error; return error + #define error_handle2(error) xmlt_errno = error; return NULL + /* extern */ #include <libxml/tree.h> *************** *** 44,52 **** static xmlBufferPtr createdtdheader(xmlDocPtr doc, xmlChar **buf1); ! static void freedtdheader(xmlBufferPtr buf, xmlChar *buf1); static xmlNodePtr *findNode(xmlDocPtr *doc, char *parent_name, char *child_name, char *content); ! #define usexmlbuffer 1 /* Externally accessable functions */ --- 47,55 ---- static xmlBufferPtr createdtdheader(xmlDocPtr doc, xmlChar **buf1); ! static void freedtdheader(xmlBufferPtr buf, xmlChar **buf1); static xmlNodePtr *findNode(xmlDocPtr *doc, char *parent_name, char *child_name, char *content); ! #define usexmlbuffer 0 /* Externally accessable functions */ *************** *** 301,314 **** xmlChar *buf1 = NULL; ! xmlBufferPtr buf = createdtdheader(doc, (char**)&buf1); dtd = xmlCreateIntSubset(doc, buf1, NULL, NULL); ! freedtdheader(buf, buf1); doc->intSubset = dtd; ! /* xmlNewChild((xmlNodePtr)dtd->children, NULL, "some stuff", NULL); */ xmlSaveFormatFile(filename, doc, 1); xmlFreeDoc(doc); } else --- 304,325 ---- xmlChar *buf1 = NULL; ! xmlBufferPtr buf = createdtdheader(doc, &buf1); ! if (!buf1) ! printf("madd debug buf1 is empty, thats why it crashes\n"); dtd = xmlCreateIntSubset(doc, buf1, NULL, NULL); ! printf("madd debug1\n"); ! /* showMemStats(); */ ! freedtdheader(buf, &buf1); ! /*showMemStats(); */ ! printf("madd debug2\n"); doc->intSubset = dtd; ! printf("madd debug3\n"); /* xmlNewChild((xmlNodePtr)dtd->children, NULL, "some stuff", NULL); */ xmlSaveFormatFile(filename, doc, 1); + printf("madd debug4\n"); xmlFreeDoc(doc); + printf("madd debug5\n"); } else *************** *** 360,366 **** if (open(filename, 0644) == -1) /* check to see if the file exist */ { ! xmlt_errno = FILE_UNEXIST; ! return NULL; } if (!n_map) { --- 371,377 ---- if (open(filename, 0644) == -1) /* check to see if the file exist */ { ! error_handle2(FILE_UNEXIST); } + if (!n_map) { *************** *** 368,372 **** return NULL; } ! doc = xmlParseFile(filename); xmlValidCtxtPtr ctxt = xmlNewValidCtxt(); --- 379,383 ---- return NULL; } ! doc = xmlParseFile(filename); xmlValidCtxtPtr ctxt = xmlNewValidCtxt(); *************** *** 425,436 **** static xmlBufferPtr createdtdheader(xmlDocPtr doc, xmlChar **buf1) { - - #if usexmlbuffer xmlChar *elem = "<!ELEMENT "; ! xmlChar *pcdata = "(#PCDATA)"; ! ! NODE_MAP *n_map = Nmap_GetData(); xmlBufferPtr buf; buf = xmlBufferCreateSize(strlen(doc->children->name) + 3); --- 436,446 ---- static xmlBufferPtr createdtdheader(xmlDocPtr doc, xmlChar **buf1) { xmlChar *elem = "<!ELEMENT "; ! xmlChar *pcdata = " (#PCDATA)"; NODE_MAP *n_map = Nmap_GetData(); + #if usexmlbuffer + + xmlBufferPtr buf; buf = xmlBufferCreateSize(strlen(doc->children->name) + 3); *************** *** 482,494 **** return buf; #else #endif } ! static void freedtdheader(xmlBufferPtr buf, xmlChar *buf1) { #if usexmlbuffer xmlBufferFree(buf); #else ! buf1 = realloc(buf1, 0); #endif } --- 492,527 ---- return buf; #else + unsigned int a = 0; + char *tmp1 = calloc(1, 512); + printf("will now use the 2nd way of doing the dtd header\n"); + sprintf(tmp1, "%s [\n%s%s ANY>", doc->children->name, elem, doc->children->name); + printf("here1\n"); + sprintf(tmp1, "%s%s%s (", tmp1, elem, n_map->parent_name); + printf("here2\n"); + while (a < n_map->total_child - 1) + { + sprintf(tmp1, "%s%s, ", tmp1, n_map->child_nodes[a]); + a++; + } + sprintf(tmp1, "%s%s)>", tmp1, n_map->child_nodes[a]); + a= 0; + while (a < n_map->total_child) + { + sprintf(tmp1, "%s%s%s%s >", tmp1, elem, n_map->child_nodes[a], pcdata); + a++; + } + sprintf(tmp1, "%s]", tmp1); + printf("createdtdheader temp1 %s\n", tmp1); + *buf1 = tmp1; + return NULL; #endif } ! static void freedtdheader(xmlBufferPtr buf, xmlChar **buf1) { #if usexmlbuffer xmlBufferFree(buf); #else ! /* *buf1 = realloc(buf1, 0); */ #endif } Index: mcd.h =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/mcd.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mcd.h 1 Nov 2004 17:55:41 -0000 1.1 --- mcd.h 24 Dec 2004 22:12:42 -0000 1.2 *************** *** 34,39 **** #ifndef MCD_QUIET #ifndef WIN32 ! #warning - Building with memory checking. ! #warning expect lower performance. - #endif #endif --- 34,39 ---- #ifndef MCD_QUIET #ifndef WIN32 ! /*#warning - Building with memory checking. ! #warning expect lower performance. -*/ #endif #endif |
|
From: nik_89 <ni...@us...> - 2004-11-29 06:28:02
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16972 Added Files: lapnumbers.bmp leds.bmp starttrack.bmp Log Message: the 3 new graphics. leds : the small lights on the starting tile starttrack : the starting tile lapnumbers : the lap numbers above and below the starting tile --- NEW FILE: starttrack.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: leds.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lapnumbers.bmp --- (This appears to be a binary file; contents omitted.) |
|
From: nik_89 <ni...@us...> - 2004-11-29 06:26:08
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16460 Modified Files: cars.c cars.h graphics.c graphics.h main.c racecore.c Log Message: Added support for 3 new graphics : the starting tile, the lap numbers and the small leds on the starting track. the game now has an ending, the lap are shown correctly and the ending waits until both cars come to a complete stop. whats left is the starting animation with the leds and the winning image. this is for the laps part. Theres still other stuff to do, but they are polishing really. Index: graphics.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/graphics.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** graphics.c 14 Nov 2004 14:49:50 -0000 1.11 --- graphics.c 29 Nov 2004 06:25:57 -0000 1.12 *************** *** 8,11 **** --- 8,12 ---- #include "cars.h" + #include "track.h" /* TRACK_START_X and _Y */ #include "graphics.h" *************** *** 15,21 **** --- 16,27 ---- static SDL_Surface *flag = NULL; static SDL_Surface *cars = NULL; + static SDL_Surface *laps = NULL; /* lap numbers */ + static SDL_Surface *stile = NULL; /* the starting track */ + static SDL_Surface *leds = NULL; /* small lights on the starting track */ static void draw_pixel(int x, int y, int color); + static const int myleds[4] = { 29 - 3, 45 - 3, 61 - 3, 77 - 3}; + /* methods */ *************** *** 115,122 **** } ! void Graphics_DrawTile(int x, int y, int index) { SDL_Rect src, dest; if (screen && tiles) { --- 121,192 ---- } ! void Graphics_DrawLed(int led) { SDL_Rect src, dest; + if (screen && leds) + { + dest.x = TRACK_XOFFSET + TRACK_START_X * TILE_WIDTH ; + dest.y = TRACK_YOFFSET + TRACK_START_Y * TILE_HEIGHT; + + dest.y += LEDS_YOFFSET - 3; + dest.x += myleds[led]; + + src.x = 0; + src.y = 0; + src.w = 11; + src.h = 11; + + SDL_BlitSurface(leds, &src, screen, &dest); + } + } + + void Graphics_DrawStartTile(int x, int y) + { + SDL_Rect src, dest; + + if (screen && stile) + { + dest.x = x - TILE_EXTRAX; + dest.y = y - TILE_EXTRAY; + + src.x = 0; + src.y = 0; + src.w = TILE_EXTRAX + TILE_WIDTH + TILE_EXTRAX; + src.h = TILE_EXTRAY + TILE_HEIGHT + TILE_EXTRAY; + + SDL_BlitSurface(stile, &src, screen, &dest); + } + } + + + void Graphics_DrawLapNum(int player, int lap) + { + SDL_Rect src, dest; + + if (screen && laps) + { + int x, y; + dest.x = TRACK_XOFFSET + TRACK_START_X * TILE_WIDTH; + dest.y = TRACK_YOFFSET + TRACK_START_Y * TILE_HEIGHT + TRACK_YOFFSET - LAP_NUMOFFSET0; + if (player) + dest.y += TILE_HEIGHT - TRACK_YOFFSET - LAP_NUMOFFSET1; + + if (lap <= LAPS_MAX) + src.x = lap * LAPS_WIDTH; + src.y = 0; + src.w = LAPS_WIDTH; + src.h = LAPS_HEIGHT; + if (src.x >= 0 && src.x < tiles->w) + { + SDL_BlitSurface(laps, &src, screen, &dest); + } + } + } + + void Graphics_DrawTile(int x, int y, int index) + { + SDL_Rect src, dest; + if (screen && tiles) { *************** *** 160,164 **** /* draw centered. fx: (x, y) is the mid point of the car, in * this program most likely between the front wheels */ ! /* fixme: go into cars.c and fix the offsets so this works */ dest.x = x; // - src.w / 2; dest.y = y; // - src.h / 2; --- 230,234 ---- /* draw centered. fx: (x, y) is the mid point of the car, in * this program most likely between the front wheels */ ! /* FIXME: go into cars.c and fix the offsets so this works */ dest.x = x; // - src.w / 2; dest.y = y; // - src.h / 2; *************** *** 270,278 **** SDL_MapRGB(cars->format, 255, 0, 255)); } - SDL_WM_SetCaption("racing", NULL); ! if (!screen || !tiles || !background || !flag) failed = 1; --- 340,368 ---- SDL_MapRGB(cars->format, 255, 0, 255)); } + laps = SDL_LoadBMP("graphics/lapnumbers.bmp"); + if (laps) + { + SDL_SetColorKey(laps, SDL_SRCCOLORKEY, + SDL_MapRGB(laps->format, 255, 0, 255)); + } + + stile = SDL_LoadBMP("graphics/starttrack.bmp"); + if (stile) + { + SDL_SetColorKey(stile, SDL_SRCCOLORKEY, + SDL_MapRGB(laps->format, 255, 0, 255)); + } + + leds = SDL_LoadBMP("graphics/leds.bmp"); + if (leds) + { + SDL_SetColorKey(leds, SDL_SRCCOLORKEY, + SDL_MapRGB(laps->format, 255, 0, 255)); + } + SDL_WM_SetCaption("racing", NULL); ! if (!screen || !tiles || !background || !flag || !cars || !laps || !stile || !leds) failed = 1; Index: cars.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** cars.h 14 Nov 2004 14:48:19 -0000 1.15 --- cars.h 29 Nov 2004 06:25:57 -0000 1.16 *************** *** 8,11 **** --- 8,13 ---- #define __CARS_H + /* for now only 2 players r supported + * we dont intend to support more than 2 */ #define NUM_PLAYERS 2 *************** *** 52,57 **** --- 54,66 ---- #define CARS_CTURNSTART_OFFSET 8 + /* def: 5 + * track laps + * don't add more than 5 laps since the + * lap number only has 6 numbers, 0 to 5*/ + #define CARS_LAP_TOTAL 5 + typedef struct { + int carid; int xpos, ypos; int xfix, yfix; /* to align the cars gfx */ Index: racecore.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/racecore.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** racecore.c 14 Nov 2004 16:42:17 -0000 1.10 --- racecore.c 29 Nov 2004 06:25:57 -0000 1.11 *************** *** 140,143 **** --- 140,148 ---- unsigned char tile = Track_GetTile(x, y); + if (x == TRACK_START_X && y == TRACK_START_Y) + Graphics_DrawStartTile( + TRACK_XOFFSET + x * TILE_WIDTH, + TRACK_YOFFSET + y * TILE_HEIGHT); + else if (tile != TT_NONE) { Index: graphics.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/graphics.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** graphics.h 14 Nov 2004 14:52:54 -0000 1.6 --- graphics.h 29 Nov 2004 06:25:57 -0000 1.7 *************** *** 25,28 **** --- 25,40 ---- #define CARS_TILES_HIGH 2 + #define LAPS_WIDTH 10 + #define LAPS_HEIGHT 11 + + #define LAP_NUMOFFSET0 17 + #define LAP_NUMOFFSET1 15 + + /* Laps numbers maximum in the bmp */ + #define LAPS_MAX 5 + + /* Leds related */ + #define LEDS_YOFFSET 27 + extern void Graphics_DebugCircle(); *************** *** 33,36 **** --- 45,51 ---- extern void Graphics_DrawBackground(void); extern void Graphics_DrawFlag(void); + extern void Graphics_DrawLapNum(int player, int lap); + extern void Graphics_DrawStartTile(int x, int y); + extern void Graphics_DrawLed(int led); extern void Graphics_ClearScreen(void); Index: main.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/main.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** main.c 24 Oct 2004 02:30:24 -0000 1.13 --- main.c 29 Nov 2004 06:25:57 -0000 1.14 *************** *** 63,71 **** failed = 1; } - else if (Cars_Init()) - { - fprintf(stderr, "cars init failed\n"); - failed = 1; - } else { --- 63,66 ---- Index: cars.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** cars.c 14 Nov 2004 16:42:17 -0000 1.24 --- cars.c 29 Nov 2004 06:25:56 -0000 1.25 *************** *** 23,27 **** static void car_offtrack(CAR_DATA *car); ! /* forward declarations */ --- 23,28 ---- static void car_offtrack(CAR_DATA *car); ! static void finish_race(CAR_DATA *car); ! static void ending(); /* forward declarations */ *************** *** 30,40 **** static CAR_DATA mycars[NUM_PLAYERS]; /* local */ static void car_offtrack(CAR_DATA *car) { int i; - if (car->speed > 0 && car->offtrack == 1) { --- 31,77 ---- static CAR_DATA mycars[NUM_PLAYERS]; + /* winner car pointer */ + CAR_DATA *winner = NULL; + + /* 1 if all the players finished */ + unsigned char finished = 0; /* used mainly to finish + the ending brake of the last car + (when it passes the finish line) */ /* local */ + static void ending() + { + /* race finished we need to show the winning image + * and go into the editor state after */ + + if (winner) + printf("Player %d wins the race!!\n", winner->carid); + + state = STATE_EDITOR; + } + + static void finish_race(CAR_DATA *car) + { + unsigned int a = 0, racing = 0; + + car->racing = 0; + /* check out all the players to see if they finished */ + while (a < NUM_PLAYERS) + { + if (mycars[a].racing == 1) + { + racing++; + break; + } + a++; + } + if (racing == 1) + winner = car; /* the current player was the first to finish */ + } + static void car_offtrack(CAR_DATA *car) { int i; if (car->speed > 0 && car->offtrack == 1) { *************** *** 492,499 **** { memset(car, 0, sizeof(CAR_DATA)); ! car->xfix = CARS_GFX_FIX_X * 0; car->yfix = CARS_GFX_FIX_Y * -1; car->current.x = TRACK_START_X; car->current.y = TRACK_START_Y; --- 529,541 ---- { memset(car, 0, sizeof(CAR_DATA)); ! ! car->carid = lane; /* unique number based on the starting lane */ car->xfix = CARS_GFX_FIX_X * 0; car->yfix = CARS_GFX_FIX_Y * -1; + + car->lap = CARS_LAP_TOTAL; + Graphics_DrawLapNum(car->carid, car->lap); + car->racing = 1; car->current.x = TRACK_START_X; car->current.y = TRACK_START_Y; *************** *** 539,542 **** --- 581,587 ---- void Cars_Move(CAR_DATA *car) { + Graphics_DrawLapNum(car->carid, car->lap); + Graphics_DrawLed(car->lap % 4); /* just to test it */ + if (car->offtrack) { *************** *** 545,555 **** else { int tx = car->current.x; int ty = car->current.y; if (car->plunger && car->speed < 50) ! car->speed = car->speed + 1; else if (!car->plunger && car->speed > 0) ! car->speed = car->speed - CARS_BRAKE_OFFSET; cars_movetrack(car); --- 590,615 ---- else { + if (car->speed <= 0 && !car->racing) + { + if (finished == 3) + ending(); + else + finished |= car->carid + 1; + + return; + } int tx = car->current.x; int ty = car->current.y; + + if (!car->racing) + { + car->plunger = 0; + car->speed -= CARS_BRAKE_OFFSET + 1; + } if (car->plunger && car->speed < 50) ! car->speed += 1; else if (!car->plunger && car->speed > 0) ! car->speed -= CARS_BRAKE_OFFSET; cars_movetrack(car); *************** *** 576,579 **** --- 636,650 ---- car->current.type, car->direction); #endif + if (car->current.x == TRACK_START_X && car->current.y == TRACK_START_Y) + { + if (car->lap <= 0) + { + finish_race(car); + return; + } + car->lap--; + Graphics_DrawLapNum(car->carid, car->lap); + } + } } |
|
From: nik_89 <ni...@us...> - 2004-11-14 16:42:26
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv414 Modified Files: cars.c racecore.c Removed Files: Makefile Log Message: removed the Makefile since it is totally useless. cars.c : changed a single // comment to /* */ racecore.c : changed starting track coords to their corresponding defines : TRACK_START_X and _Y Index: racecore.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/racecore.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** racecore.c 20 Oct 2004 00:24:57 -0000 1.9 --- racecore.c 14 Nov 2004 16:42:17 -0000 1.10 *************** *** 62,66 **** /* (3, 4) is reserved for the start */ ! if (tx != 3 || ty != 4) { if (tileheld == TT_NONE) --- 62,66 ---- /* (3, 4) is reserved for the start */ ! if (tx != TRACK_START_X || ty != TRACK_START_Y) { if (tileheld == TT_NONE) --- Makefile DELETED --- Index: cars.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** cars.c 14 Nov 2004 14:48:19 -0000 1.23 --- cars.c 14 Nov 2004 16:42:17 -0000 1.24 *************** *** 485,489 **** } ! //Track_NextDirection(track, &car->direction); return 0; } --- 485,489 ---- } ! /* Track_NextDirection(track, &car->direction); */ return 0; } |
|
From: um, r. <sm...@us...> - 2004-11-14 14:53:05
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9496 Modified Files: Makefile graphics.h racecore.h track.c track.h Removed Files: track_1-2.bmp trackdemo.bmp Log Message: .bmp removed unused files graphics.h added constants to help draw cars racecore nothing new, file just got touched track removed xml junk, made calls into persist to save/load the map --- track_1-2.bmp DELETED --- Index: track.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/track.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** track.h 17 Oct 2004 16:41:29 -0000 1.6 --- track.h 14 Nov 2004 14:52:54 -0000 1.7 *************** *** 11,14 **** --- 11,17 ---- #define TRACK_HEIGHT 5 + #define TRACK_START_X 3 + #define TRACK_START_Y 4 + #define OFFSET_RAIL1 42 #define OFFSET_RAIL2 57 Index: graphics.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/graphics.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** graphics.h 17 Oct 2004 06:07:29 -0000 1.5 --- graphics.h 14 Nov 2004 14:52:54 -0000 1.6 *************** *** 22,30 **** #define TRACK_YOFFSET 38 extern void Graphics_DebugCircle(); extern void Graphics_DrawTile(int x, int y, int index); ! extern void Graphics_DrawCar(int x, int y, int car, int rotation, int color); extern void Graphics_DrawBackground(void); extern void Graphics_DrawFlag(void); --- 22,34 ---- #define TRACK_YOFFSET 38 + #define CARS_TILES_WIDE 16 + #define CARS_TILES_HIGH 2 + extern void Graphics_DebugCircle(); extern void Graphics_DrawTile(int x, int y, int index); ! extern void Graphics_DrawCar(int x, int y, int player, int rotation, ! int transparent); extern void Graphics_DrawBackground(void); extern void Graphics_DrawFlag(void); *************** *** 32,36 **** extern void Graphics_ClearScreen(void); extern void Graphics_UpdateScreen(void); - extern int Graphics_SetCarColor(int R, int G, int B); /* these return 0 on success and 1 on failure */ --- 36,39 ---- Index: Makefile =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 14 Nov 2004 12:04:00 -0000 1.6 --- Makefile 14 Nov 2004 14:52:53 -0000 1.7 *************** *** 6,10 **** ifeq ($(opt),yes) ! CFLAGS = -s -O2 -fomit-frame-pointer -DNDEBUG endif --- 6,10 ---- ifeq ($(opt),yes) ! CFLAGS = -Wall -s -O2 -fomit-frame-pointer -DNDEBUG endif Index: racecore.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/racecore.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** racecore.h 17 Oct 2004 19:50:58 -0000 1.3 --- racecore.h 14 Nov 2004 14:52:54 -0000 1.4 *************** *** 16,19 **** --- 16,20 ---- extern int state; + void Editor_MouseDown(int x, int y, int button); void Editor_MouseUp(int x, int y, int button); --- trackdemo.bmp DELETED --- Index: track.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/track.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** track.c 14 Nov 2004 12:00:26 -0000 1.8 --- track.c 14 Nov 2004 14:52:54 -0000 1.9 *************** *** 77,82 **** /* track start is assumed to be in the center of the screen going from * left to right. */ ! int x = 3; ! int y = 4; int isvalid = 1; int direction = 1; /* clockwise from top */ --- 77,82 ---- /* track start is assumed to be in the center of the screen going from * left to right. */ ! int x = TRACK_START_X; ! int y = TRACK_START_Y; int isvalid = 1; int direction = 1; /* clockwise from top */ *************** *** 96,100 **** { /* see if we have got back to the start */ ! if (x == 3 && y == 4) { break; --- 96,100 ---- { /* see if we have got back to the start */ ! if (x == TRACK_START_X && y == TRACK_START_Y) { break; *************** *** 114,117 **** --- 114,118 ---- { memset(mytrack, 0, sizeof(unsigned char) * TRACK_WIDTH * TRACK_HEIGHT); + Track_SetTile(TRACK_START_X, TRACK_START_Y, TT_HORIZONTAL); } *************** *** 121,126 **** int Track_Init() { ! memset(mytrack, 0, sizeof(unsigned char) * TRACK_WIDTH * TRACK_HEIGHT); ! Track_SetTile(3, 4, TT_HORIZONTAL); /* track start */ #ifdef CFG_PERSISTENT_TRACK --- 122,126 ---- int Track_Init() { ! Track_Clear(); #ifdef CFG_PERSISTENT_TRACK |
|
From: um, r. <sm...@us...> - 2004-11-14 14:49:58
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9261 Modified Files: graphics.c Log Message: returned graphics.c back to it's passive state. it shouldn't have to call other modules to find out what to draw and how. Index: graphics.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/graphics.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** graphics.c 12 Nov 2004 02:26:34 -0000 1.10 --- graphics.c 14 Nov 2004 14:49:50 -0000 1.11 *************** *** 16,20 **** static SDL_Surface *cars = NULL; ! static void drawpixel(int x, int y, int color); /* methods */ --- 16,20 ---- static SDL_Surface *cars = NULL; ! static void draw_pixel(int x, int y, int color); /* methods */ *************** *** 41,45 **** ypos += (y * TILE_HEIGHT) + extra_y; ! drawpixel(xpos, ypos, 0); angle++; } --- 41,45 ---- ypos += (y * TILE_HEIGHT) + extra_y; ! draw_pixel(xpos, ypos, 0); angle++; } *************** *** 63,67 **** ypos += (y * TILE_HEIGHT) + extra_y; ! drawpixel(xpos, ypos, 0); angle++; } --- 63,67 ---- ypos += (y * TILE_HEIGHT) + extra_y; ! draw_pixel(xpos, ypos, 0); angle++; } *************** *** 85,89 **** ypos += (y * TILE_HEIGHT) + extra_y; ! drawpixel(xpos, ypos, 0); angle++; } --- 85,89 ---- ypos += (y * TILE_HEIGHT) + extra_y; ! draw_pixel(xpos, ypos, 0); angle++; } *************** *** 107,111 **** ypos += (y * TILE_HEIGHT) + extra_y; ! drawpixel(xpos, ypos, 0); angle++; } --- 107,111 ---- ypos += (y * TILE_HEIGHT) + extra_y; ! draw_pixel(xpos, ypos, 0); angle++; } *************** *** 115,123 **** } - int Graphics_SetCarColor(int R, int G, int B) - { - return SDL_MapRGB(screen->format, R, G, B); - } - void Graphics_DrawTile(int x, int y, int index) { --- 115,118 ---- *************** *** 140,167 **** } ! void Graphics_DrawCar(int x, int y, int car, int rotation, int color) { ! #if CARS_GFX ! CARS_DATA *buf = Cars_GetCarData(car); ! if (buf->offtrack == 2) ! { ! /* we make the car be semi apparent */ ! /* printf("car is coming back from a spinoff (spam)\n"); */ ! SDL_SetAlpha(cars, SDL_SRCALPHA, 100); ! } ! SDL_Rect rec1 = {rotation * CARS_GFX_OFFSETX, color * CARS_GFX_OFFSETX, CARS_GFX_OFFSETX, CARS_GFX_OFFSETY }; ! SDL_Rect rec2 = { x, y, CARS_GFX_OFFSETX, CARS_GFX_OFFSETY}; ! SDL_BlitSurface(cars, &rec1, screen, &rec2); ! if (buf->offtrack == 2) { ! /* we bring back the cars as opaque */ ! ! SDL_SetAlpha(cars, 0, SDL_ALPHA_OPAQUE); ! } ! #else ! drawpixel(x, y, color); #endif - return; } --- 135,169 ---- } ! void Graphics_DrawCar(int x, int y, int player, int rotation, ! int transparent) { ! #ifdef DRAW_CARS_AS_PIXELS ! if (player) ! draw_pixel(x, y, SDL_MapRGB(screen->format, 255, 0, 0)); ! else ! draw_pixel(x, y, SDL_MapRGB(screen->format, 0, 0, 255)); ! #else ! SDL_Rect src, dest; ! ! if (screen && cars) { ! src.w = cars->w / CARS_TILES_WIDE; ! src.h = cars->h / CARS_TILES_HIGH; ! src.x = rotation * src.w; ! src.y = player * src.h; ! if (transparent) ! SDL_SetAlpha(cars, SDL_SRCALPHA, 192); ! else ! SDL_SetAlpha(cars, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); ! ! /* draw centered. fx: (x, y) is the mid point of the car, in ! * this program most likely between the front wheels */ ! /* fixme: go into cars.c and fix the offsets so this works */ ! dest.x = x; // - src.w / 2; ! dest.y = y; // - src.h / 2; ! SDL_BlitSurface(cars, &src, screen, &dest); ! } #endif } *************** *** 209,213 **** /* local */ ! static void drawpixel(int x, int y, int color) { SDL_LockSurface(screen); --- 211,215 ---- /* local */ ! static void draw_pixel(int x, int y, int color) { SDL_LockSurface(screen); |
|
From: um, r. <sm...@us...> - 2004-11-14 14:48:27
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8365 Modified Files: cars.c cars.h events.c Log Message: cars.c changed cars to mycars. no longer dynamically allocated changed num/cnum parameters to a pointer to the car to be worked on removed get/set car, bad way of doing things added plunger up/down to replace what get/set car was being used for removed some unused variables cleaned up the code a bit (i found several 'blank lines' with loads of tabs in them) cars.h commented out some unused variables added prototypes for plunger up/down removed prototypes for get/set car events.c made the changes for the set/get plunger up/down stuff Index: cars.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** cars.h 14 Nov 2004 00:44:12 -0000 1.14 --- cars.h 14 Nov 2004 14:48:19 -0000 1.15 *************** *** 8,15 **** #define __CARS_H ! /* if set to 0, the cars will be dots instead of ! * images ! */ ! #define CARS_GFX 1 /* to fix the cars positionning on the track */ #define CARS_GFX_FIX_X 8 --- 8,16 ---- #define __CARS_H ! #define NUM_PLAYERS 2 ! ! /* the cars will be dots instead of images */ ! /* #define DRAW_CARS_AS_PIXELS */ ! /* to fix the cars positionning on the track */ #define CARS_GFX_FIX_X 8 *************** *** 17,51 **** #define CARS_GFX_ANGLE_OFFSET 22.5; ! /* normal value = 3 ! * ! * The higher this value, the slower the cars ! * will go ! * ! */ #define CARS_SPEED_OFFSET 4 ! /* normal value = 2 ! * ! * the higher this value, the faster the cars ! * will brake ! * ! */ #define CARS_BRAKE_OFFSET 1 ! /* normal value = 46 ! * ! * the higher this value, the less likely to spin * off (min = 0(instant spin off), max = 50) ! * ! */ #define CARS_SPINOFF_OFFSET 46 - /* normal value = 2 - * - * the lower this value, the longer the spinoff * will last. - */ - #define CARS_SPINOFF_BRAKE_OFFSET 2 ! /* Start coordinates coding */ ! #define CARS_START_X car[num]->xpos = (TRACK_XOFFSET + (car[num]->current.x * TILE_WIDTH) + TILE_WIDTH / 2) ! #define CARS_START_Y car[num]->ypos = (TRACK_YOFFSET + (car[num]->current.y * TILE_HEIGHT) + (car[num]->lane ? OFFSET_RAIL2 : OFFSET_RAIL1)) ! /* Cars gfx Offsets */ #define CARS_GFX_OFFSETX 28 #define CARS_GFX_OFFSETY 28 --- 18,38 ---- #define CARS_GFX_ANGLE_OFFSET 22.5; ! /* def: 3 ! * the higher this value, the slower the cars will go */ #define CARS_SPEED_OFFSET 4 ! ! /* def: 2 ! * the higher this value, the faster the cars will brake */ #define CARS_BRAKE_OFFSET 1 ! ! /* def: 46 min: 0 max: 50 ! * the higher this value, the less likely to spin off, 0 for instant spin off */ #define CARS_SPINOFF_OFFSET 46 ! /* def: 2 ! * the lower this value, the longer the spinoff will last */ ! #define CARS_SPINOFF_BRAKE_OFFSET 2 ! /* cars gfx offsets */ #define CARS_GFX_OFFSETX 28 #define CARS_GFX_OFFSETY 28 *************** *** 53,67 **** #define CARS_GFX_TOTALY 56 ! /* the counter clockwise * track turn starting angle offset ! * default is 8 and is jerky ! * 15 is jerky on top left and top right ! */ #define CARS_CCTURNSTART_OFFSET 15 ! /* the clockwise ! * track turn starting angle offset ! * default is 8 ! */ #define CARS_CTURNSTART_OFFSET 8 --- 40,53 ---- #define CARS_GFX_TOTALY 56 ! /* def: 8 ! * the counter clockwise * track turn starting angle offset ! * the default (8) is jerky ! * 15 is jerky on top left and top right */ #define CARS_CCTURNSTART_OFFSET 15 ! /* def: 8 ! * the clockwise ! * track turn starting angle offset */ #define CARS_CTURNSTART_OFFSET 8 *************** *** 76,80 **** unsigned short angle; unsigned short rotation; ! unsigned int color; unsigned short lap; int direction; --- 62,66 ---- unsigned short angle; unsigned short rotation; ! //unsigned int color; unsigned short lap; int direction; *************** *** 89,98 **** unsigned char racing; unsigned char offtrack; ! unsigned char visible; ! } CARS_DATA; enum { ! CARS_UP, /* 0 */ CARS_RIGHT, CARS_DOWN, --- 75,84 ---- unsigned char racing; unsigned char offtrack; ! //unsigned char visible; ! } CAR_DATA; enum { ! CARS_UP = 0, CARS_RIGHT, CARS_DOWN, *************** *** 100,118 **** }; - extern int Cars_Move(int num); - extern int Cars_Poll(); - extern void Cars_Draw(); - extern CARS_DATA *Cars_GetCarData(int num); ! extern void Cars_SetCarData(int num, CARS_DATA *buf); extern int Cars_Init(void); extern int Cars_Cleanup(void); - extern const float xtable[361]; - extern const float ytable[361]; - #endif --- 86,104 ---- }; + extern const float xtable[361]; + extern const float ytable[361]; ! extern void Cars_PlungerDown(int carid); ! extern void Cars_PlungerUp(int carid); + extern void Cars_Move(CAR_DATA *car); + extern int Cars_Poll(void); + extern void Cars_Draw(void); extern int Cars_Init(void); extern int Cars_Cleanup(void); #endif + Index: events.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/events.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** events.c 20 Oct 2004 00:24:57 -0000 1.9 --- events.c 14 Nov 2004 14:48:19 -0000 1.10 *************** *** 31,34 **** --- 31,39 ---- break; + case SDLK_3: + if (Track_IsValid()) + state = STATE_RACING; + break; + case SDLK_ESCAPE: quit = 1; *************** *** 36,52 **** case SDLK_d: ! { ! CARS_DATA *buf = Cars_GetCarData(1); ! buf->plunger = 1; ! Cars_SetCarData(1, (CARS_DATA*)buf); ! } break; case SDLK_k: ! { ! CARS_DATA *buf = Cars_GetCarData(2); ! buf->plunger = 1; ! Cars_SetCarData(2, (CARS_DATA*)buf); ! } break; --- 41,49 ---- case SDLK_d: ! Cars_PlungerDown(0); break; case SDLK_k: ! Cars_PlungerDown(1); break; *************** *** 65,81 **** { case SDLK_d: ! { ! CARS_DATA *buf = Cars_GetCarData(1); ! buf->plunger = 0; ! Cars_SetCarData(1, (CARS_DATA*)buf); ! } break; case SDLK_k: ! { ! CARS_DATA *buf = Cars_GetCarData(2); ! buf->plunger = 0; ! Cars_SetCarData(2, (CARS_DATA*)buf); ! } break; --- 62,70 ---- { case SDLK_d: ! Cars_PlungerUp(0); break; case SDLK_k: ! Cars_PlungerUp(1); break; Index: cars.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** cars.c 14 Nov 2004 00:44:12 -0000 1.22 --- cars.c 14 Nov 2004 14:48:19 -0000 1.23 *************** *** 12,237 **** #include "table.inc" ! #define debug 0 #define set_clockwise_offtrack 1 ! static int cars_movetrack(int cnum); ! static void cars_turn_cc(int cnum, int from_angle, ! int to_angle, int extra_x, int extra_y, int extra_fix); ! static void cars_turn_c(int cnum, int from_angle, [...1213 lines suppressed...] ! set_cartwo(); return 0; } --- 598,603 ---- int Cars_Init() { ! init_car(&mycars[0], 0); ! init_car(&mycars[1], 1); return 0; } *************** *** 662,668 **** int Cars_Cleanup() { - free(car); return 0; } - --- 605,609 ---- |
|
From: um, r. <sm...@us...> - 2004-11-14 12:04:13
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1138 Modified Files: Makefile Log Message: added persist as a make flag. fx: persist=yes to include track save/load which in turn utilises xmltools. Index: Makefile =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 16 Oct 2004 04:34:58 -0000 1.5 --- Makefile 14 Nov 2004 12:04:00 -0000 1.6 *************** *** 9,12 **** --- 9,17 ---- endif + ifeq ($(persist),yes) + OBJS += persist.o + CFLAGS += -DCFG_PERSISTENT_TRACK + endif + all: $(BINARY) |
|
From: um, r. <sm...@us...> - 2004-11-14 12:02:25
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv878 Modified Files: racing.h Added Files: persist.c persist.h Log Message: put all the xml stuff in another file so users aren't bound to it Index: racing.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/racing.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** racing.h 16 Oct 2004 04:34:58 -0000 1.2 --- racing.h 14 Nov 2004 12:02:00 -0000 1.3 *************** *** 5,8 **** --- 5,12 ---- */ + /* whether or not to save and load the track between runs. toggle this from + * the Makefile */ + /* #define CFG_PERSISTENT_TRACK */ + #include "track.h" #include "graphics.h" *************** *** 11,12 **** --- 15,20 ---- #include "cars.h" + #ifdef CFG_PERSISTENT_TRACK + # include "persist.h" + #endif + --- NEW FILE: persist.c --- /* persist.c * * saves and loads stuf between execution * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "xmltools/xmltools.h" #include "racing.h" int Persist_LoadTrack() { NODE_MAP *template; NODE_MAP *n_map; char *x, *y, *type; int i, fd; char num[5]; /* check to see if save_racetrack.xml exists(?) * note: whoever wrote this doesn't know about stat()? */ fd = open(SAVEFILE, 0644); if (fd == -1) return 1; close(fd); Xmltool_GetXmlDesc(SAVEFILE); template = Nmap_GetData(); for (i = 0; i < TRACK_WIDTH * TRACK_HEIGHT; i++) { memset(num, '\0', 5); snprintf(num, 5, "%d", i); n_map = (NODE_MAP *)Xmltool_MReadXml(SAVEFILE, template->parent_name, "num", num); x = (char *)Nmap_GetContent("x"); y = (char *)Nmap_GetContent("y"); type = (char *)Nmap_GetContent("type"); Track_SetTile(atoi(x), atoi(y), type[0] - 'A'); } /* delete the file? someone comment this please */ fd = open(SAVEFILE, 0644); if (fd != -1) unlink(SAVEFILE); close(fd); /* Hmm, you open an xml file, get pointers to some strings using * Nmap_GetContent(), but you don't call anything to free the Content? * The strings Nmap_GetContent returns are probably allocated in memory * somewhere, mem leak? */ return 0; } int Persist_SaveTrack() { char *savefile = SAVEFILE; int x = 0; int y = 0, id = 0; char strx[11], stry[11], type[2], num[11]; type[1] = '\0'; Nmap_Clear(); for (y = 0; y < TRACK_HEIGHT; y++) { for (x = 0; x < TRACK_WIDTH; x++) { printf("here\n"); snprintf(strx, 11, "%d", x); snprintf(stry, 11, "%d", y); snprintf(num, 11, "%d", id); *type = 'A' + Track_GetTile(x, y); /* printf("num %s type %s\n x-y(%s-%s)\n", num, type, strx, stry); */ Nmap_Add("track", "num", num); Nmap_Add("track", "type", type); Nmap_Add("track", "x", strx); Nmap_Add("track", "y", stry); Xmltool_MAddXml(savefile); id++; } } printf("saved racetrack successfully\n"); return 0; } --- NEW FILE: persist.h --- /* persist.h * * saves and loads stuf between execution * */ #ifndef __PERSIST_H #define __PERSIST_H #define SAVEFILE "save_racetrack.xml" /* these return 0 on success and 1 on failure */ extern int Persist_LoadTrack(void); extern int Persist_SaveTrack(void); #endif |
|
From: um, r. <sm...@us...> - 2004-11-14 12:00:38
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv531 Modified Files: track.c Log Message: exported xml stuff to another file Index: track.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/track.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** track.c 11 Nov 2004 22:26:56 -0000 1.7 --- track.c 14 Nov 2004 12:00:26 -0000 1.8 *************** *** 11,20 **** /* change back to track.h later. really this module only needs to know about * itself and won't be making any calls to other modules */ ! #include "racing.h" ! - #include "xmltools/xmltools.h" - static unsigned char mytrack[TRACK_WIDTH][TRACK_HEIGHT]; --- 11,17 ---- /* change back to track.h later. really this module only needs to know about * itself and won't be making any calls to other modules */ ! #include "track.h" static unsigned char mytrack[TRACK_WIDTH][TRACK_HEIGHT]; *************** *** 119,167 **** } /* constructors/destructors */ int Track_Init() { - memset(mytrack, 0, sizeof(unsigned char) * TRACK_WIDTH * TRACK_HEIGHT); Track_SetTile(3, 4, TT_HORIZONTAL); /* track start */ - - #if load_track - /* load the map from the save file */ - int a = 0; - if (a = open("save_racetrack.xml", 0644) == -1) - { - return 0; - } - close(a); - - Xmltool_GetXmlDesc("save_racetrack.xml"); - NODE_MAP *template = Nmap_GetData(); - - char num[5]; - a = 0; - NODE_MAP *n_map = NULL; - char *x, *y, *type; - while (a < 30) - { - memset(num, '\0', 5); - sprintf(num, "%d", a); - n_map = (NODE_MAP*)Xmltool_MReadXml("save_racetrack.xml", template->parent_name, "num", num); - x = (char*)Nmap_GetContent("x"); - y = (char*)Nmap_GetContent("y"); - type = (char*)Nmap_GetContent("type"); - - Track_SetTile(atoi(x), atoi(y), type[0] - 'A'); - a++; - } - int fd = 0; - if (fd = open("save_racetrack.xml", 0644) != -1) - unlink("save_racetrack.xml"); - close(fd); ! /* end of map loading */ #endif ! ! #if sample_debug_track /* debug sample track */ Track_SetTile(4, 4, TT_BOTTOMRIGHT_CORNER); --- 116,133 ---- } + /* constructors/destructors */ int Track_Init() { memset(mytrack, 0, sizeof(unsigned char) * TRACK_WIDTH * TRACK_HEIGHT); Track_SetTile(3, 4, TT_HORIZONTAL); /* track start */ ! #ifdef CFG_PERSISTENT_TRACK ! Persist_LoadTrack(); #endif ! ! //#if rigorous_debug_track ! #if 1 /* debug sample track */ Track_SetTile(4, 4, TT_BOTTOMRIGHT_CORNER); *************** *** 206,232 **** #endif - #if old_track_size - Track_SetTile(6, 4, TT_HORIZONTAL); - Track_SetTile(7, 4, TT_BOTTOMRIGHT_CORNER); - Track_SetTile(7, 3, TT_TOPRIGHT_CORNER); - Track_SetTile(6, 3, TT_BOTTOMLEFT_CORNER); - Track_SetTile(6, 2, TT_TOPLEFT_CORNER); - Track_SetTile(7, 2, TT_HORIZONTAL); - Track_SetTile(8, 2, TT_TOPRIGHT_CORNER); - Track_SetTile(8, 3, TT_VERTICAL); - Track_SetTile(8, 4, TT_VERTICAL); - Track_SetTile(8, 5, TT_BOTTOMRIGHT_CORNER); - Track_SetTile(7, 5, TT_TOPLEFT_CORNER); - Track_SetTile(7, 6, TT_BOTTOMRIGHT_CORNER); - Track_SetTile(6, 6, TT_HORIZONTAL); - Track_SetTile(5, 6, TT_HORIZONTAL); - Track_SetTile(4, 6, TT_BOTTOMLEFT_CORNER); - Track_SetTile(4, 5, TT_VERTICAL); - Track_SetTile(4, 4, TT_VERTICAL); - Track_SetTile(4, 3, TT_TOPLEFT_CORNER); - Track_SetTile(5, 3, TT_TOPRIGHT_CORNER); - Track_SetTile(5, 4, TT_BOTTOMLEFT_CORNER); - #endif - return 0; } --- 172,175 ---- *************** *** 234,278 **** int Track_Cleanup() { ! #if save_track /* save the track configuration if it is valid */ if (Track_IsValid()) ! { ! char *savefile = "save_racetrack.xml"; ! int x = 0; ! int y = 0, a = 0; ! char strx[20], stry[20], type[5], num[5]; ! Nmap_Clear(); ! while (y < 5) ! { ! printf("here\n"); ! memset(strx, '\0', 20); ! memset(stry, '\0', 20); ! memset(type, '\0', 5); ! memset(num, '\0', 5); ! ! sprintf(strx, "%d", x); ! sprintf(stry, "%d", y); ! sprintf(num, "%d", a); ! type[0] = mytrack[x][y] + 'A'; ! ! /* printf("num %s type %s\n x-y(%s-%s)\n", num, type, strx, stry); */ ! ! Nmap_Add("track", "num", num); ! Nmap_Add("track", "type", type); ! Nmap_Add("track", "x", strx); ! Nmap_Add("track", "y", stry); ! Xmltool_MAddXml(savefile); ! ! x++; ! if (x >= 6) ! { ! y++; ! x = 0; ! } ! a++; ! } ! printf("saved racetrack successfully\n"); ! } #endif return 0; } --- 177,186 ---- int Track_Cleanup() { ! #ifdef CFG_PERSISTENT_TRACK /* save the track configuration if it is valid */ if (Track_IsValid()) ! Persist_SaveTrack(); #endif + return 0; } |
|
From: nik_89 <ni...@us...> - 2004-11-14 00:44:41
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14754 Modified Files: cars.c cars.h Log Message: trackfiles.bmp : Very neat tiles made by Lee (he took them from bilbana but edited them to fit). Index: cars.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** cars.h 11 Nov 2004 23:17:33 -0000 1.13 --- cars.h 14 Nov 2004 00:44:12 -0000 1.14 *************** *** 53,56 **** --- 53,68 ---- #define CARS_GFX_TOTALY 56 + /* the counter clockwise + * track turn starting angle offset + * default is 8 and is jerky + * 15 is jerky on top left and top right + */ + #define CARS_CCTURNSTART_OFFSET 15 + + /* the clockwise + * track turn starting angle offset + * default is 8 + */ + #define CARS_CTURNSTART_OFFSET 8 typedef struct Index: cars.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** cars.c 12 Nov 2004 02:26:34 -0000 1.21 --- cars.c 14 Nov 2004 00:44:12 -0000 1.22 *************** *** 15,18 **** --- 15,19 ---- #define set_clockwise_offtrack 1 + static int cars_movetrack(int cnum); static void cars_turn_cc(int cnum, int from_angle, *************** *** 85,89 **** int to_angle, int extra_x, int extra_y, int extra_fix) { ! const int offset_angle_from = 8; int a = abs(car[cnum]->speed / CARS_SPEED_OFFSET); car[cnum]->xfix = CARS_GFX_FIX_X * -1; --- 86,90 ---- int to_angle, int extra_x, int extra_y, int extra_fix) { ! const int offset_angle_from = CARS_CCTURNSTART_OFFSET; int a = abs(car[cnum]->speed / CARS_SPEED_OFFSET); car[cnum]->xfix = CARS_GFX_FIX_X * -1; *************** *** 164,168 **** {0, 9} }; ! const int offset_angle_from = 8; int circle_size = 64; if (car[cnum]->lane) --- 165,169 ---- {0, 9} }; ! const int offset_angle_from = CARS_CTURNSTART_OFFSET; int circle_size = 64; if (car[cnum]->lane) *************** *** 665,666 **** --- 666,668 ---- } + |
|
From: nik_89 <ni...@us...> - 2004-11-14 00:44:22
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14754/graphics Modified Files: tracktiles.bmp Log Message: trackfiles.bmp : Very neat tiles made by Lee (he took them from bilbana but edited them to fit). Index: tracktiles.bmp =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/graphics/tracktiles.bmp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvs4EsAe7 and /tmp/cvslENjIq differ |
|
From: nik_89 <ni...@us...> - 2004-11-12 02:26:45
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25701 Modified Files: cars.c graphics.c Log Message: Added the final part of the spinning off part : the transparent post spin off return on the track. Index: graphics.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/graphics.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** graphics.c 23 Oct 2004 03:31:38 -0000 1.9 --- graphics.c 12 Nov 2004 02:26:34 -0000 1.10 *************** *** 143,149 **** --- 143,163 ---- { #if CARS_GFX + CARS_DATA *buf = Cars_GetCarData(car); + if (buf->offtrack == 2) + { + /* we make the car be semi apparent */ + /* printf("car is coming back from a spinoff (spam)\n"); */ + SDL_SetAlpha(cars, SDL_SRCALPHA, 100); + } SDL_Rect rec1 = {rotation * CARS_GFX_OFFSETX, color * CARS_GFX_OFFSETX, CARS_GFX_OFFSETX, CARS_GFX_OFFSETY }; SDL_Rect rec2 = { x, y, CARS_GFX_OFFSETX, CARS_GFX_OFFSETY}; SDL_BlitSurface(cars, &rec1, screen, &rec2); + if (buf->offtrack == 2) + { + /* we bring back the cars as opaque */ + + SDL_SetAlpha(cars, 0, SDL_ALPHA_OPAQUE); + } + #else drawpixel(x, y, color); *************** *** 251,256 **** if (cars) { ! SDL_SetColorKey(cars, SDL_SRCCOLORKEY, ! SDL_MapRGB(cars->format, 255, 0, 255)); } --- 265,270 ---- if (cars) { ! SDL_SetColorKey(cars, SDL_SRCCOLORKEY, ! SDL_MapRGB(cars->format, 255, 0, 255)); } Index: cars.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** cars.c 11 Nov 2004 23:17:33 -0000 1.20 --- cars.c 12 Nov 2004 02:26:34 -0000 1.21 *************** *** 53,57 **** if (car[cnum]->offtrack == 1) { ! printf("curx %d cury %d\nlastx %d lasty %d\nxspin %d yspin %d\n", car[cnum]->xpos, car[cnum]->ypos, car[cnum]->lastxpos, car[cnum]->lastypos, car[cnum]->xspeed, car[cnum]->yspeed); car[cnum]->offtrack = 2; /* the replacing part */ car[cnum]->rotation = car[cnum]->lastrotation; --- 53,57 ---- if (car[cnum]->offtrack == 1) { ! /* printf("curx %d cury %d\nlastx %d lasty %d\nxspin %d yspin %d\n", car[cnum]->xpos, car[cnum]->ypos, car[cnum]->lastxpos, car[cnum]->lastypos, car[cnum]->xspeed, car[cnum]->yspeed); */ car[cnum]->offtrack = 2; /* the replacing part */ car[cnum]->rotation = car[cnum]->lastrotation; *************** *** 68,72 **** || car[cnum]->ypos == car[cnum]->lastypos) { ! printf("car back on track\n"); car[cnum]->xpos = car[cnum]->lastxpos; car[cnum]->ypos = car[cnum]->lastypos; --- 68,72 ---- || car[cnum]->ypos == car[cnum]->lastypos) { ! /* printf("car back on track\n"); */ car[cnum]->xpos = car[cnum]->lastxpos; car[cnum]->ypos = car[cnum]->lastypos; |
|
From: nik_89 <ni...@us...> - 2004-11-11 23:17:42
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13103 Modified Files: cars.c cars.h Log Message: fixed the spinning off. only thing to do with it is make it transparent when its coming back. Index: cars.h =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** cars.h 23 Oct 2004 03:31:38 -0000 1.12 --- cars.h 11 Nov 2004 23:17:33 -0000 1.13 *************** *** 60,63 **** --- 60,64 ---- int lastxpos, lastypos; /* used when spinned off */ int xspeed, yspeed; /* used when spinned off */ + int lastrotation; /* used when spinned off */ double speed; unsigned short angle; Index: cars.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** cars.c 11 Nov 2004 22:26:56 -0000 1.19 --- cars.c 11 Nov 2004 23:17:33 -0000 1.20 *************** *** 44,48 **** } car[cnum]->speed -= CARS_SPINOFF_BRAKE_OFFSET; ! if (car[cnum]->rotation < 16) car[cnum]->rotation += 1; else --- 44,48 ---- } car[cnum]->speed -= CARS_SPINOFF_BRAKE_OFFSET; ! if (car[cnum]->rotation < 15) car[cnum]->rotation += 1; else *************** *** 52,69 **** { if (car[cnum]->offtrack == 1) car[cnum]->offtrack = 2; /* the replacing part */ int a = abs(car[cnum]->speed / CARS_SPEED_OFFSET); while (a--) ! if (car[cnum]->ypos < YRES - 20) /* to counter off screen gaps */ { ! car[cnum]->xpos -= car[cnum]->xspeed; ! car[cnum]->ypos -= car[cnum]->yspeed; ! if (car[cnum]->xpos == (car[cnum]->lastxpos * car[cnum]->yspeed) ! && car[cnum]->ypos == (car[cnum]->lastypos * car[cnum]->xspeed)) { printf("car back on track\n"); car[cnum]->speed = 0; car[cnum]->offtrack = 0; ! break; } --- 52,77 ---- { if (car[cnum]->offtrack == 1) + { + printf("curx %d cury %d\nlastx %d lasty %d\nxspin %d yspin %d\n", car[cnum]->xpos, car[cnum]->ypos, car[cnum]->lastxpos, car[cnum]->lastypos, car[cnum]->xspeed, car[cnum]->yspeed); car[cnum]->offtrack = 2; /* the replacing part */ + car[cnum]->rotation = car[cnum]->lastrotation; + } int a = abs(car[cnum]->speed / CARS_SPEED_OFFSET); + while (a--) ! if (car[cnum]->ypos < YRES - 19) /* to counter screen gaps */ { ! /* printf("curx %d cury %d\n", car[cnum]->xpos, car[cnum]->ypos); */ ! car[cnum]->xpos += (car[cnum]->xspeed * -1); ! car[cnum]->ypos += (car[cnum]->yspeed * -1); ! if (car[cnum]->xpos == car[cnum]->lastxpos ! || car[cnum]->ypos == car[cnum]->lastypos) { printf("car back on track\n"); + car[cnum]->xpos = car[cnum]->lastxpos; + car[cnum]->ypos = car[cnum]->lastypos; car[cnum]->speed = 0; car[cnum]->offtrack = 0; ! return; } *************** *** 139,142 **** --- 147,151 ---- car[cnum]->lastxpos = car[cnum]->xpos; car[cnum]->lastypos = car[cnum]->ypos; + car[cnum]->lastrotation = car[cnum]->rotation; } car[cnum]->speed -= abs(car[cnum]->speed / 40); *************** *** 223,226 **** --- 232,236 ---- car[cnum]->lastxpos = car[cnum]->xpos; car[cnum]->lastypos = car[cnum]->ypos; + car[cnum]->lastrotation = car[cnum]->rotation; } #endif |
|
From: nik_89 <ni...@us...> - 2004-11-11 22:27:06
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32544 Modified Files: CMakeLists.txt cars.c track.c Log Message: added the saving of the tracks but I have disabled it since xmltools needed tweaks. added a buggy spinoff, it currently doesnt place the car on the track when it spins Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/CMakeLists.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CMakeLists.txt 23 Oct 2004 14:41:38 -0000 1.2 --- CMakeLists.txt 11 Nov 2004 22:26:55 -0000 1.3 *************** *** 6,11 **** TARGET_LINK_LIBRARIES(mwindows) ELSE (WIN32) ! LINK_LIBRARIES(SDL m pthread) ! INCLUDE_DIRECTORIES(/usr/include /usr/include/sdl-1.2) ENDIF (WIN32) --- 6,12 ---- TARGET_LINK_LIBRARIES(mwindows) ELSE (WIN32) ! LINK_DIRECTORIES(. ./lib) ! LINK_LIBRARIES(SDL m pthread xmltools) ! INCLUDE_DIRECTORIES(/usr/include /usr/include/sdl-1.2 ./include) ENDIF (WIN32) Index: cars.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** cars.c 23 Oct 2004 03:31:38 -0000 1.18 --- cars.c 11 Nov 2004 22:26:56 -0000 1.19 *************** *** 34,38 **** static void car_offtrack(int cnum) { ! if (car[cnum]->speed > 0) { int a = abs(car[cnum]->speed / CARS_SPEED_OFFSET); --- 34,38 ---- static void car_offtrack(int cnum) { ! if (car[cnum]->speed > 0 && car[cnum]->offtrack == 1) { int a = abs(car[cnum]->speed / CARS_SPEED_OFFSET); *************** *** 44,53 **** } car[cnum]->speed -= CARS_SPINOFF_BRAKE_OFFSET; } else { ! car[cnum]->xpos = car[cnum]->lastxpos; ! car[cnum]->ypos = car[cnum]->lastypos; ! car[cnum]->offtrack = 0; } return; --- 44,73 ---- } car[cnum]->speed -= CARS_SPINOFF_BRAKE_OFFSET; + if (car[cnum]->rotation < 16) + car[cnum]->rotation += 1; + else + car[cnum]->rotation = 0; } else { ! if (car[cnum]->offtrack == 1) ! car[cnum]->offtrack = 2; /* the replacing part */ ! int a = abs(car[cnum]->speed / CARS_SPEED_OFFSET); ! while (a--) ! if (car[cnum]->ypos < YRES - 20) /* to counter off screen gaps */ ! { ! car[cnum]->xpos -= car[cnum]->xspeed; ! car[cnum]->ypos -= car[cnum]->yspeed; ! if (car[cnum]->xpos == (car[cnum]->lastxpos * car[cnum]->yspeed) ! && car[cnum]->ypos == (car[cnum]->lastypos * car[cnum]->xspeed)) ! { ! printf("car back on track\n"); ! car[cnum]->speed = 0; ! car[cnum]->offtrack = 0; ! break; ! } ! ! } ! car[cnum]->speed += CARS_SPINOFF_BRAKE_OFFSET; } return; *************** *** 580,584 **** void Cars_SetCarData(int num, CARS_DATA *buf) ! { car[num] = buf; return; --- 600,604 ---- void Cars_SetCarData(int num, CARS_DATA *buf) ! { /* to change, will need a memcpy() */ car[num] = buf; return; *************** *** 596,600 **** if (!car[a]->offtrack) Cars_Move(a); ! else if (car[a]->offtrack) car_offtrack(a); a++; --- 616,620 ---- if (!car[a]->offtrack) Cars_Move(a); ! else car_offtrack(a); a++; Index: track.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/track.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** track.c 17 Oct 2004 17:48:00 -0000 1.6 --- track.c 11 Nov 2004 22:26:56 -0000 1.7 *************** *** 14,17 **** --- 14,20 ---- + + #include "xmltools/xmltools.h" + static unsigned char mytrack[TRACK_WIDTH][TRACK_HEIGHT]; *************** *** 120,126 **** --- 123,167 ---- int Track_Init() { + memset(mytrack, 0, sizeof(unsigned char) * TRACK_WIDTH * TRACK_HEIGHT); Track_SetTile(3, 4, TT_HORIZONTAL); /* track start */ + + #if load_track + /* load the map from the save file */ + int a = 0; + if (a = open("save_racetrack.xml", 0644) == -1) + { + return 0; + } + close(a); + + Xmltool_GetXmlDesc("save_racetrack.xml"); + NODE_MAP *template = Nmap_GetData(); + + char num[5]; + a = 0; + NODE_MAP *n_map = NULL; + char *x, *y, *type; + while (a < 30) + { + memset(num, '\0', 5); + sprintf(num, "%d", a); + n_map = (NODE_MAP*)Xmltool_MReadXml("save_racetrack.xml", template->parent_name, "num", num); + x = (char*)Nmap_GetContent("x"); + y = (char*)Nmap_GetContent("y"); + type = (char*)Nmap_GetContent("type"); + + Track_SetTile(atoi(x), atoi(y), type[0] - 'A'); + a++; + } + int fd = 0; + if (fd = open("save_racetrack.xml", 0644) != -1) + unlink("save_racetrack.xml"); + close(fd); + /* end of map loading */ + #endif + + #if sample_debug_track /* debug sample track */ Track_SetTile(4, 4, TT_BOTTOMRIGHT_CORNER); *************** *** 143,147 **** Track_SetTile(1, 4, TT_BOTTOMLEFT_CORNER); Track_SetTile(2, 4, TT_HORIZONTAL); ! #if simple_debug_track Track_SetTile(4, 4, TT_HORIZONTAL); --- 184,189 ---- Track_SetTile(1, 4, TT_BOTTOMLEFT_CORNER); Track_SetTile(2, 4, TT_HORIZONTAL); ! #endif ! #if simple_debug_track Track_SetTile(4, 4, TT_HORIZONTAL); *************** *** 192,195 **** --- 234,278 ---- int Track_Cleanup() { + #if save_track + /* save the track configuration if it is valid */ + if (Track_IsValid()) + { + char *savefile = "save_racetrack.xml"; + int x = 0; + int y = 0, a = 0; + char strx[20], stry[20], type[5], num[5]; + Nmap_Clear(); + while (y < 5) + { + printf("here\n"); + memset(strx, '\0', 20); + memset(stry, '\0', 20); + memset(type, '\0', 5); + memset(num, '\0', 5); + + sprintf(strx, "%d", x); + sprintf(stry, "%d", y); + sprintf(num, "%d", a); + type[0] = mytrack[x][y] + 'A'; + + /* printf("num %s type %s\n x-y(%s-%s)\n", num, type, strx, stry); */ + + Nmap_Add("track", "num", num); + Nmap_Add("track", "type", type); + Nmap_Add("track", "x", strx); + Nmap_Add("track", "y", stry); + Xmltool_MAddXml(savefile); + + x++; + if (x >= 6) + { + y++; + x = 0; + } + a++; + } + printf("saved racetrack successfully\n"); + } + #endif return 0; } |
|
From: nik_89 <ni...@us...> - 2004-11-11 22:27:06
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32544/graphics Modified Files: background.bmp Log Message: added the saving of the tracks but I have disabled it since xmltools needed tweaks. added a buggy spinoff, it currently doesnt place the car on the track when it spins Index: background.bmp =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/graphics/background.bmp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsHE2Qe1 and /tmp/cvs6QBHoU differ |
|
From: nik_89 <ni...@us...> - 2004-11-01 18:37:07
|
Update of /cvsroot/xmltools/xmltools/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22896 Modified Files: CMakeLists.txt Log Message: very tiny fix Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/xmltools/xmltools/src/CMakeLists.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CMakeLists.txt 1 Nov 2004 17:56:24 -0000 1.5 --- CMakeLists.txt 1 Nov 2004 18:36:57 -0000 1.6 *************** *** 31,34 **** ENDIF (WIN32) ! #go in the dir test and process CMakeLists.txt from there too ! SUBDIRS(tests) --- 31,34 ---- ENDIF (WIN32) ! # go in the dir test and process CMakeLists.txt from there too ! # SUBDIRS(tests) |