anet-checkins Mailing List for ANet (Page 3)
Status: Abandoned
Brought to you by:
benad
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(17) |
Dec
(29) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(29) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Prasanna G. <gpr...@us...> - 2001-12-04 20:14:17
|
Update of /cvsroot/anet/IP_Sample In directory usw-pr-cvs1:/tmp/cvs-serv18378 Log Message: IP Sample file Directory Status: Vendor Tag: Sample Release Tags: start N IP_Sample/.dont_delete N IP_Sample/FilesSpecific.h N IP_Sample/Makefile N IP_Sample/Makefile.in N IP_Sample/build_exclusion.txt N IP_Sample/build_locations.txt N IP_Sample/build_makefile.pl N IP_Sample/main.c N IP_Sample/IP_Sample/udpclient.c N IP_Sample/IP_Sample/tcpclient.c N IP_Sample/IP_Sample/syncserver.c No conflicts created by this import ***** Bogus filespec: - Imported sources |
From: Benoit N. <be...@us...> - 2001-12-04 00:50:06
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Common In directory usw-pr-cvs1:/tmp/cvs-serv31253 Modified Files: Files.h Log Message: "" Index: Files.h =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Common/Files.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Files.h 2001/12/04 00:45:04 1.3 --- Files.h 2001/12/04 00:50:03 1.4 *************** *** 3,8 **** Declarations for file management in the ANet deamon. Those declarations are common to all platforms. ! Platform-specific declarations are in: ! ANet_Daemon/<platform>/FilesSpecific.h Part of the run-time wrapper of the ANet project. --- 3,8 ---- Declarations for file management in the ANet deamon. Those declarations are common to all platforms. ! Platform-specific declarations are in: ! ANet_Daemon/<platform>/FilesSpecific.h Part of the run-time wrapper of the ANet project. |
From: Benoit N. <be...@us...> - 2001-12-04 00:45:49
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv30067 Added Files: FilesSpecific.h Log Message: Starting File Wrappers... --- NEW FILE: FilesSpecific.h --- /****************************************************************** ANet_Daemon/Linux/FilesSpecific.h Declarations for file management in the ANet deamon. Those declarations are specific to Linux. Cross-platform declarations are in: ANet_Daemon/Common/Files.h Part of the run-time wrapper of the ANet project. Distributed under GPL: http://www.gnu.org/copyleft/gpl.html ******************************************************************/ #ifndef ANET_FILES_SPECIFIC #define ANET_FILES_SPECIFIC typedef struct { //... UInt8 busy; UInt8 async; } ANetFile; #endif |
From: Benoit N. <be...@us...> - 2001-12-04 00:45:06
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Common In directory usw-pr-cvs1:/tmp/cvs-serv29901/Common Modified Files: Files.h Log Message: Starting File Wrappers... Index: Files.h =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Common/Files.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Files.h 2001/10/14 23:16:35 1.2 --- Files.h 2001/12/04 00:45:04 1.3 *************** *** 2,6 **** ANet_Daemon/Common/Files.h Declarations for file management in the ANet deamon. ! Part of the run-time wrapper of the ANet project. --- 2,9 ---- ANet_Daemon/Common/Files.h Declarations for file management in the ANet deamon. ! Those declarations are common to all platforms. ! Platform-specific declarations are in: ! ANet_Daemon/<platform>/FilesSpecific.h ! Part of the run-time wrapper of the ANet project. *************** *** 10,13 **** --- 13,32 ---- #ifndef ANET_FILES #define ANET_FILES + + #include "Memory.h" + #include "FilesSpecific.h" + + ANetFile ANetInitFile(); + UInt32 ANetGetSetFilePath(ANetFile *f, ANetMemoryTag path, UInt8 set); + UInt32 ANetGetSetFileAsync(ANetFile *f, UInt8 *async, UInt8 set); + UInt8 ANetIsFileBusy(ANetFile *f); + UInt32 ANetGetFileSize(ANetFile *f, UInt32 *size); + UInt32 ANetOpenFile(ANetFile *f); + UInt32 ANetCloseFile(ANetFile *f); + UInt32 ANetReadFile(ANetFile *f, UInt32 startPos, UInt32 length, ANetMemoryTag buffer, UInt32 *read); + UInt32 ANetWriteFile(ANetFile *f, ANetMemoryTag buffer); + UInt32 ANetWriteFileAt(ANetFile *f, ANetMemoryTag buffer, UInt32 pos); + UInt32 ANetDeleteFile(ANetFile *f); + UInt32 ANetCopyFile(ANetFile *source, ANetFile *dest); #endif |
From: Benoit N. <be...@us...> - 2001-12-01 21:59:42
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv479 Modified Files: Makefile Log Message: Cleaned up Makefile Index: Makefile =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 2001/12/01 01:48:09 1.5 --- Makefile 2001/12/01 21:59:38 1.6 *************** *** 9,13 **** build: Makefile_real.out ! @$(MAKE) -f Makefile_real.out build_clean: --- 9,13 ---- build: Makefile_real.out ! @$(MAKE) -j --no-print-directory -f Makefile_real.out build_clean: *************** *** 25,29 **** cat Makefile.in Makefile.in2 > Makefile_real.out rm -f Makefile.in2 ! @$(MAKE) -f Makefile_real.out .PHONY: all build clean rebuild --- 25,29 ---- cat Makefile.in Makefile.in2 > Makefile_real.out rm -f Makefile.in2 ! @$(MAKE) -j --no-print-directory -f Makefile_real.out .PHONY: all build clean rebuild |
From: Benoit N. <be...@us...> - 2001-12-01 21:47:23
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv30736 Modified Files: build_makefile.pl Log Message: Corrected Makefile generation. Index: build_makefile.pl =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/build_makefile.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build_makefile.pl 2001/11/17 00:06:25 1.2 --- build_makefile.pl 2001/12/01 21:47:19 1.3 *************** *** 104,108 **** if ($#headers >= 0) { ! print "$fileName:"; foreach my $header (@headers) { --- 104,108 ---- if ($#headers >= 0) { ! print "$1.o:"; foreach my $header (@headers) { |
From: Benoit N. <be...@us...> - 2001-12-01 01:55:42
|
Update of /cvsroot/anet/ANet In directory usw-pr-cvs1:/tmp/cvs-serv3585 Modified Files: CONTRIB Log Message: "" Index: CONTRIB =================================================================== RCS file: /cvsroot/anet/ANet/CONTRIB,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CONTRIB 2001/11/08 13:57:31 1.2 --- CONTRIB 2001/12/01 01:55:39 1.3 *************** *** 4,8 **** people add copyrighted work to the project. ! Updated: 11/06/01 Benoit Nadeau (Benad): --- 4,8 ---- people add copyrighted work to the project. ! Updated: 11/30/01 Benoit Nadeau (Benad): *************** *** 13,15 **** Ajaya Krishnamurthy: mailto:aj...@in... ! mailto:aj...@us... \ No newline at end of file --- 13,19 ---- Ajaya Krishnamurthy: mailto:aj...@in... ! mailto:aj...@us... ! ! Chirag Kantharia: ! mailto:ch...@ya... ! mailto:ch...@us... |
From: Benoit N. <be...@us...> - 2001-12-01 01:48:13
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Common In directory usw-pr-cvs1:/tmp/cvs-serv1955/Common Added Files: Args.c Args.h Log Message: Added argument string parser/generator --- NEW FILE: Args.c --- #include "Args.h" /* int main(int argc, char ** argv) { char * inString; char * ptr; char * argument; int i, argsSize; argsSize = 0; for(i = 0; i < argc; i++) { for(ptr = argv[i]; *ptr; ptr++, argsSize++); argsSize++; } printf("argsSize = %d\n", argsSize); if (!(inString = malloc(argsSize))) return -1; MakeArgumentString(argc, argv, inString, argsSize); printf("The argument string is [%s]\n", inString); if (!(argument = malloc(80))) return -1; if (GetArgument(inString, "d", argument, 80) != 0) printf("Argument -d is not passed\n"); else printf("argument -d is [%s]\n", argument); free(argument); if (!(argument = malloc(80))) return -1; if (GetArgument(inString, "c", argument, 80) != 0) printf("Argument -c is not passed\n"); else printf("argument -c is [%s]\n", argument); free(inString); return 0; } */ void MakeArgumentString(int argc, char ** argv, char * outArgs, int argsSize) { char * ptr; int i, j; j = 0; for(i = 0; i < argc && j < argsSize; i++, j++) { for(ptr = argv[i]; *ptr; ptr++, j++) outArgs[j] = *ptr; outArgs[j] = ' '; } outArgs[j - 1] = '\0'; } int GetArgument(char * inString, char * inArg, char * outVal, int valSize) { int retval = 1; char * ptr; int inArgLen, len, i; inArgLen = strlen(inArg); len = strlen(inString); ptr = inString; while(*ptr) { if (*ptr == '-') { ptr++; if (*ptr == '-') { ptr++; if (inArgLen > 1 && !strncmp(ptr, inArg, inArgLen)) { retval = 0; ptr += inArgLen; while (*ptr && *ptr == ' ') ptr++; if (*ptr && *ptr == '-') { return retval; } else if (*ptr && *ptr == '\'') { ptr++; for(i = 0; *ptr && *ptr != '\''; i++, ptr++) outVal[i] = *ptr; } else if (*ptr && *ptr == '\"') { ptr++; for(i = 0; *ptr && *ptr != '\"'; i++, ptr++) outVal[i] = *ptr; } else if (*ptr) { for(i = 0; *ptr && *ptr != ' '; i++, ptr++) outVal[i] = *ptr; } } } else if (inArgLen == 1) { while (*ptr && *ptr != ' ') { if (*ptr == inArg[0]) { ptr++; retval = 0; continue; } ptr++; } if (retval) continue; while (*ptr && *ptr == ' ') ptr++; if (*ptr && *ptr == '-') { return retval; } else if (*ptr && *ptr == '\'') { ptr++; for(i = 0; *ptr && *ptr != '\''; i++, ptr++) outVal[i] = *ptr; } else if (*ptr && *ptr == '\"') { ptr++; for(i = 0; *ptr && *ptr != '\"'; i++, ptr++) outVal[i] = *ptr; } else if (*ptr) { for(i = 0; *ptr && *ptr != ' '; i++, ptr++) outVal[i] = *ptr; } } } ptr++; } return retval; } --- NEW FILE: Args.h --- #include <stdio.h> #include <stdlib.h> #include <string.h> void MakeArgumentString(int argc, char ** argv, char * outArgs, int argsSize); int GetArgument(char * inString, char * inArg, char * outVal, int valSize); |
From: Benoit N. <be...@us...> - 2001-12-01 01:48:13
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv1955/Linux Modified Files: Makefile main.c Log Message: Added argument string parser/generator Index: Makefile =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 2001/11/17 00:06:25 1.4 --- Makefile 2001/12/01 01:48:09 1.5 *************** *** 11,14 **** --- 11,17 ---- @$(MAKE) -f Makefile_real.out + build_clean: + rm -f *.o + clean: rm -f anetd Index: main.c =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.c 2001/11/11 17:55:42 1.3 --- main.c 2001/12/01 01:48:09 1.4 *************** *** 2,7 **** --- 2,9 ---- #include <stdlib.h> #include "Modules.h" + #include "Args.h" void MemoryTest(); + void ArgsTest(); int main(int argc, char **argv) *************** *** 10,14 **** //Do some stuff here... ! MemoryTest(); printf("Closing ANet daemon...\n"); --- 12,17 ---- //Do some stuff here... ! //MemoryTest(); ! ArgsTest(); printf("Closing ANet daemon...\n"); *************** *** 27,29 **** --- 30,44 ---- printf("Size = %d\n", (int)(GetMemoryBlockSize(tag))); DeleteMemoryBlock(tag); + } + + void ArgsTest() + { + int argc = 5; + char *argv[5] = {"-c","\"3des\"","-vw","--hello-w","hello"}; + char *args = (char*)(malloc(40)); + char *val = (char*)(malloc(40)); + + MakeArgumentString(argc, argv, args, 40); + printf("%d\n", GetArgument(args, "hello-w", val, 40)); + printf("%s\n", val); } |
From: Benoit N. <be...@us...> - 2001-11-17 00:06:28
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv16291/ANet_Daemon/Linux Modified Files: Makefile Makefile.in build_exclusion.txt build_locations.txt build_makefile.pl Log Message: Built Makefile generator Index: Makefile =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 2001/11/15 19:33:07 1.3 --- Makefile 2001/11/17 00:06:25 1.4 *************** *** 1,53 **** SHELL = /bin/sh ! # Add paths to all the headers here. ! header_paths = -I. -I../Common -I../Core -I../Common/Lists ! ! # Change compiler options here ! compiler = gcc -g ${header_paths} -Wall ! # Add source and header files paths here ! vpath %.c . ! vpath %.c ../Common/ ! vpath %.c ../Common/Lists/ ! vpath %.c ../Core/ ! vpath %.h . ! vpath %.h ../Common/ ! vpath %.h ../Common/Lists/ ! vpath %.h ../Core/ ! # Default rule to compile *.c files. ! %.o: %.c ! ${compiler} -c $< -o $@ ! # Linking target ! anetd: DoubleLinkedLists.o LinkedLists.o BinaryTrees.o Memory.o main.o ! ${compiler} $^ -lm -o anetd ! # Add files to compile here. ! # Append file-specific header after the *.c files ! DoubleLinkedLists.o: DoubleLinkedLists.c LinkedLists.h ! LinkedLists.o: LinkedLists.c LinkedLists.h ! BinaryTrees.o: BinaryTrees.c LinkedLists.h ! Memory.o: Memory.c Memory.h ! main.o: main.c Modules.h ! # Header dependencies. Neat, no? ! Modules.h: Memory.h Packets.h XMLCommon.h LinkedLists.h ! @touch ../Common/Modules.h ! Packets.h: Memory.h ! @touch ../Common/Memory.h ! XMLCommon.h: Memory.h ! @touch ../Common/XMLCommon.h ! LinkedLists.h: ANetCommon.h ! @touch ../Common/Lists/LinkedLists.h ! Memory.h: ANetCommon.h ! @touch ../Common/Memory.h - # Special targets below. - all: test - clean: build_clean - rm -f anetd - build_clean: - rm -f *.o - .PHONY: all clean build_clean \ No newline at end of file --- 1,27 ---- SHELL = /bin/sh ! all: build ! Makefile_real.out: ! perl build_makefile.pl > Makefile.in2 ! cat Makefile.in Makefile.in2 > Makefile_real.out ! rm -f Makefile.in2 ! build: Makefile_real.out ! @$(MAKE) -f Makefile_real.out ! clean: ! rm -f anetd ! rm -f *.o ! rm -f Makefile.in2 ! rm -f Makefile_real.out ! rebuild: ! rm -f Makefile.out ! perl build_makefile.pl > Makefile.in2 ! cat Makefile.in Makefile.in2 > Makefile_real.out ! rm -f Makefile.in2 ! @$(MAKE) -f Makefile_real.out ! .PHONY: all build clean rebuild Index: Makefile.in =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.in 2001/11/16 02:45:18 1.1 --- Makefile.in 2001/11/17 00:06:25 1.2 *************** *** 7,10 **** --- 7,13 ---- compiler = gcc -g ${header_paths} -Wall + # Change linker options here + linker = gcc -lm + # Add source and header files paths here vpath %.c . Index: build_exclusion.txt =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/build_exclusion.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build_exclusion.txt 2001/11/16 02:45:18 1.1 --- build_exclusion.txt 2001/11/17 00:06:25 1.2 *************** *** 3,5 **** StubModule.c ModuleLoader.c - --- 3,4 ---- Index: build_locations.txt =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/build_locations.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build_locations.txt 2001/11/16 02:45:18 1.1 --- build_locations.txt 2001/11/17 00:06:25 1.2 *************** *** 2,4 **** ../Common ../Common/Lists ! ../Core --- 2,4 ---- ../Common ../Common/Lists ! ../Core \ No newline at end of file Index: build_makefile.pl =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/build_makefile.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build_makefile.pl 2001/11/16 02:45:18 1.1 --- build_makefile.pl 2001/11/17 00:06:25 1.2 *************** *** 1,4 **** --- 1,8 ---- #!/usr/bin/perl + # Makefile generator for the ANet project. + # By Benad. + # Distributed under GPL. + use strict; *************** *** 9,22 **** sub main() { - if ($ARGV[0] eq '--help') - { - print "help info...\n"; - return; - } my @fileExclusionList; open(EXCLUSION, 'build_exclusion.txt'); while (<EXCLUSION>) { ! chop(); push(@fileExclusionList, $_); } --- 13,25 ---- sub main() { my @fileExclusionList; open(EXCLUSION, 'build_exclusion.txt'); while (<EXCLUSION>) { ! tr/\n//d; ! if ($_ eq '') ! { ! next; ! } push(@fileExclusionList, $_); } *************** *** 26,30 **** while (<DIRLIST>) { ! chop(); opendir(DIR, $_); my @files = readdir(DIR); --- 29,37 ---- while (<DIRLIST>) { ! tr/\n//d; ! if ($_ eq '') ! { ! next; ! } opendir(DIR, $_); my @files = readdir(DIR); *************** *** 61,65 **** while (<FILE>) { ! chop(); if (/^\#include *\"(.*?)\"/) { --- 68,72 ---- while (<FILE>) { ! tr/\n//d; if (/^\#include *\"(.*?)\"/) { *************** *** 112,116 **** } print "\n\t"; ! print '${compiler} $^ -lm -o anetd'; print "\n"; } --- 119,123 ---- } print "\n\t"; ! print '${linker} $^ -o anetd'; print "\n"; } |
From: Benoit N. <be...@us...> - 2001-11-16 02:45:21
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv15972/ANet_Daemon/Linux Added Files: Makefile.in build_exclusion.txt build_locations.txt build_makefile.pl Log Message: "" --- NEW FILE: Makefile.in --- SHELL = /bin/sh # Add paths to all the headers here. header_paths = -I. -I../Common -I../Core -I../Common/Lists # Change compiler options here compiler = gcc -g ${header_paths} -Wall # Add source and header files paths here vpath %.c . vpath %.c ../Common/ vpath %.c ../Common/Lists/ vpath %.c ../Core/ vpath %.h . vpath %.h ../Common/ vpath %.h ../Common/Lists/ vpath %.h ../Core/ # Default rule to compile *.c files. %.o: %.c ${compiler} -c $< -o $@ # Special targets below. all: anetd clean: build_clean rm -f anetd build_clean: rm -f *.o .PHONY: all clean build_clean --- NEW FILE: build_exclusion.txt --- sample.c IMC.c StubModule.c ModuleLoader.c --- NEW FILE: build_locations.txt --- . ../Common ../Common/Lists ../Core --- NEW FILE: build_makefile.pl --- #!/usr/bin/perl use strict; sub main(); main(); sub main() { if ($ARGV[0] eq '--help') { print "help info...\n"; return; } my @fileExclusionList; open(EXCLUSION, 'build_exclusion.txt'); while (<EXCLUSION>) { chop(); push(@fileExclusionList, $_); } close(EXCLUSION); my @fileList; open(DIRLIST, 'build_locations.txt'); while (<DIRLIST>) { chop(); opendir(DIR, $_); my @files = readdir(DIR); for my $item (@files) { $item =~ /^(.*)\.[ch]$/; my $exclude = 0; foreach my $compare (@fileExclusionList) { if ($compare eq $item) { $exclude = 1; last; } } if (-f "$_/$item" && !$exclude && -r "$_/$item" && $1) { push(@fileList, "$_/$item"); } } closedir(DIR); } close(DIRLIST); my @objectList; foreach my $file (@fileList) { #print "$file\n"; $file =~ m:^.*/(.*?\.[hc]):; my $fileName = $1; my @headers; open(FILE, $file); while (<FILE>) { chop(); if (/^\#include *\"(.*?)\"/) { my $exclude = 0; foreach my $compare (@fileExclusionList) { if ($compare eq $1) { $exclude = 1; last; } } if (!$exclude) { push(@headers, $1); } } } close(FILE); if ($fileName =~ /^(.*?).h$/) { if ($#headers >= 0) { print "$fileName:"; foreach my $header (@headers) { print " $header"; } print "\n\t\@touch $file\n"; } } elsif ($fileName =~ /^(.*?).c$/) { push(@objectList, "$1.o"); if ($#headers >= 0) { print "$fileName:"; foreach my $header (@headers) { print " $header"; } print "\n"; } } } print "anetd:"; foreach my $objectFile (@objectList) { print " $objectFile"; } print "\n\t"; print '${compiler} $^ -lm -o anetd'; print "\n"; } |
From: Benoit N. <be...@us...> - 2001-11-16 02:45:21
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Common/Lists In directory usw-pr-cvs1:/tmp/cvs-serv15972/ANet_Daemon/Common/Lists Removed Files: sample.c Log Message: "" --- sample.c DELETED --- |
From: Benoit N. <be...@us...> - 2001-11-16 02:45:21
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Common/Lists/samples In directory usw-pr-cvs1:/tmp/cvs-serv15972/ANet_Daemon/Common/Lists/samples Added Files: sample.c Log Message: "" --- NEW FILE: sample.c --- /* Benad's linked lists. Simple, fast linked lists. That's it. WARNING: Using a broken linked list with any of those functions may crash your computer, and/or do something crazy with it. I tested my functions enough to know that if that happens, it's not MY fault... */ #include <stdio.h> #include <stdlib.h> #include "LinkedLists.h" UInt8 SimpleDestructor(NodePtr theNode); UInt8 SimpleIsWhatIWant(NodePtr theNode); SInt8 SimpleCompare(NodePtr a, NodePtr b); int main(int argc, char **argv) { DoubleNodePtr a, b, c, list; /*NodePtr found;*/ /*BinaryNodePtr binaryTree, newVal;*/ UInt32 nbr; a = malloc(sizeof(DoubleNode)); b = malloc(sizeof(DoubleNode)); c = malloc(sizeof(DoubleNode)); a->next = b; a->prev = NULL; b->next = c; b->prev = NULL; c->next = NULL; c->prev = NULL; list = a; nbr = NbrNodes((NodePtr)(a)); SplitAndMergeSort((NodePtr*)(&list), SimpleCompare); /*FillPrev(list);*/ /*binaryTree = SortedDoubleToBinary(list);*/ /*newVal = malloc(sizeof(BinaryNode)); newVal->left = newVal->right = (BinaryNodePtr)(0); InsertInTree(newVal, &binaryTree, SimpleCompare);*/ BalanceTree((BinaryNodePtr*)(&list)); /*List is like fully unbalanced tree*/ /*if (SplitAtNth(a, 2) != c) return 1;*/ /*if (GetNthNode(a, 2) != c) return 1; found = FindAndMoveOut(&a, SimpleIsWhatIWant); nbr = NbrNodes(found); if (DestroyLinkedList(found, SimpleDestructor) != nbr) /* ACK! Error! */ /* return 1;*/ /*InvertList(&list);*/ /*SplitAndMergeSort(&(NodePtr)(list), SimpleCompare);*/ /*InvertDoubleList(&list);*/ return 0; } UInt8 SimpleDestructor(NodePtr theNode) { free(theNode); return (!theNode); } UInt8 SimpleIsWhatIWant(NodePtr theNode) { return (UInt8)(theNode); } SInt8 SimpleCompare(NodePtr a, NodePtr b) { return (a-b); } |
From: Benoit N. <be...@us...> - 2001-11-16 02:20:35
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Common/Lists/samples In directory usw-pr-cvs1:/tmp/cvs-serv11639/samples Log Message: Directory /cvsroot/anet/ANet/ANet_Daemon/Common/Lists/samples added to the repository |
From: Benoit N. <be...@us...> - 2001-11-15 19:33:11
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv561 Modified Files: Makefile Log Message: "" Index: Makefile =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 2001/11/11 17:50:22 1.2 --- Makefile 2001/11/15 19:33:07 1.3 *************** *** 30,34 **** LinkedLists.o: LinkedLists.c LinkedLists.h BinaryTrees.o: BinaryTrees.c LinkedLists.h ! Memory.o: Memory.c ANetCommon.h main.o: main.c Modules.h --- 30,34 ---- LinkedLists.o: LinkedLists.c LinkedLists.h BinaryTrees.o: BinaryTrees.c LinkedLists.h ! Memory.o: Memory.c Memory.h main.o: main.c Modules.h *************** *** 42,45 **** --- 42,47 ---- LinkedLists.h: ANetCommon.h @touch ../Common/Lists/LinkedLists.h + Memory.h: ANetCommon.h + @touch ../Common/Memory.h # Special targets below. |
From: Benoit N. <be...@us...> - 2001-11-11 17:55:45
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv300/Linux Modified Files: main.c Log Message: "" Index: main.c =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.c 2001/11/11 17:50:22 1.2 --- main.c 2001/11/11 17:55:42 1.3 *************** *** 8,13 **** { printf("Starting ANet daemon...\n"); ! MemoryTest(); //Do some stuff here... printf("Closing ANet daemon...\n"); return 0; --- 8,15 ---- { printf("Starting ANet daemon...\n"); ! //Do some stuff here... + MemoryTest(); + printf("Closing ANet daemon...\n"); return 0; |
From: Benoit N. <be...@us...> - 2001-11-11 17:50:26
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv30333/Linux Modified Files: Makefile main.c Log Message: Added Memory Management (MM) Stubs Index: Makefile =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 2001/11/05 23:27:03 1.1 --- Makefile 2001/11/11 17:50:22 1.2 *************** *** 5,9 **** # Change compiler options here ! compiler = gcc -g ${header_paths} # Add source and header files paths here --- 5,9 ---- # Change compiler options here ! compiler = gcc -g ${header_paths} -Wall # Add source and header files paths here *************** *** 22,26 **** # Linking target ! anetd: DoubleLinkedLists.o LinkedLists.o BinaryTrees.o main.o ${compiler} $^ -lm -o anetd --- 22,26 ---- # Linking target ! anetd: DoubleLinkedLists.o LinkedLists.o BinaryTrees.o Memory.o main.o ${compiler} $^ -lm -o anetd *************** *** 30,33 **** --- 30,34 ---- LinkedLists.o: LinkedLists.c LinkedLists.h BinaryTrees.o: BinaryTrees.c LinkedLists.h + Memory.o: Memory.c ANetCommon.h main.o: main.c Modules.h Index: main.c =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Linux/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.c 2001/11/05 23:27:03 1.1 --- main.c 2001/11/11 17:50:22 1.2 *************** *** 3,11 **** --- 3,27 ---- #include "Modules.h" + void MemoryTest(); + int main(int argc, char **argv) { printf("Starting ANet daemon...\n"); + MemoryTest(); //Do some stuff here... printf("Closing ANet daemon...\n"); return 0; + } + + void MemoryTest() + { + char *buffer = (char*)(0); + ANetMemoryTag tag; + + tag = NewMemoryBlock(20, 0); + printf("Size = %d\n", (int)(GetMemoryBlockSize(tag))); + ResolveMemoryTag(tag, (UInt8**)(&buffer)); + buffer[0] = 15; + printf("Size = %d\n", (int)(GetMemoryBlockSize(tag))); + DeleteMemoryBlock(tag); } |
From: Benoit N. <be...@us...> - 2001-11-11 17:50:26
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Core In directory usw-pr-cvs1:/tmp/cvs-serv30333/Core Added Files: Memory.c Log Message: Added Memory Management (MM) Stubs --- NEW FILE: Memory.c --- /****************************************************************** ANet_Daemon/Core/Memory.c Memory management for the run-time wrapper of the daemon. Part of the ANet project. Distributed under GPL: http://www.gnu.org/copyleft/gpl.html ******************************************************************/ #include "Memory.h" #include <stdlib.h> /* Current memory format: ANetMemoryTag is a memory location. The first 4 bytes are the size of the block. The remaining bytes is the data itself. */ ANetMemoryTag NewMemoryBlock(UInt32 size, UInt32 flags) { // Soft-limit of 500MB assumed UInt32 *mem; if (size & 0xC0000000) { return (ANetMemoryTag)(0); } mem = (UInt32*)(malloc(size + sizeof(UInt32))); mem[0] = size; return (ANetMemoryTag)(mem); } UInt32 DeleteMemoryBlock(ANetMemoryTag tag) { if (!tag) return 1; free((char*)(tag)); return 0; } UInt32 GetMemoryBlockSize(ANetMemoryTag tag) { return *(UInt32*)(tag); } UInt32 ResolveMemoryTag(ANetMemoryTag tag, UInt8 **ptr) { // Soft-limit of 500MB assumed if (!tag) return 1; if (!ptr) return 1; if (*((UInt32*)(tag)) & 0xC0000000) return 1; *ptr = (UInt8*)((UInt32*)(tag) + 1); return 0; } |
From: Benoit N. <be...@us...> - 2001-11-08 13:57:34
|
Update of /cvsroot/anet/ANet In directory usw-pr-cvs1:/tmp/cvs-serv5292 Modified Files: CONTRIB Log Message: "" Index: CONTRIB =================================================================== RCS file: /cvsroot/anet/ANet/CONTRIB,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CONTRIB 2001/11/06 17:19:25 1.1 --- CONTRIB 2001/11/08 13:57:31 1.2 *************** *** 7,11 **** Benoit Nadeau (Benad): ! mailto:be...@us..., ! mailto:be...@ma..., http://homepage.mac.com/benad/ --- 7,15 ---- Benoit Nadeau (Benad): ! mailto:be...@us... ! mailto:be...@ma... http://homepage.mac.com/benad/ + + Ajaya Krishnamurthy: + mailto:aj...@in... + mailto:aj...@us... \ No newline at end of file |
From: Benoit N. <be...@us...> - 2001-11-07 21:31:57
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Core In directory usw-pr-cvs1:/tmp/cvs-serv13260 Modified Files: ModuleLoader.c Log Message: "" Index: ModuleLoader.c =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Core/ModuleLoader.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ModuleLoader.c 2001/11/07 21:26:10 1.2 --- ModuleLoader.c 2001/11/07 21:31:54 1.3 *************** *** 31,33 **** //store info in list } ! UInt32 ANetAddModuleName(ANetModuleInfo *modInfo, char *moduleName) { // TO use the madule structure. } UInt32 ANetAddFunctionMap(ANetModuleInfo *modInfo, ANetFunctionMap *funcMap) { // I am not sure as yet. } \ No newline at end of file --- 31,43 ---- //store info in list } ! ! UInt32 ANetAddModuleName(ANetModuleInfo *modInfo, char *moduleName) ! { ! // TO use the madule structure. ! } ! ! ! UInt32 ANetAddFunctionMap(ANetModuleInfo *modInfo, ANetFunctionMap *funcMap) ! { ! // I am not sure as yet. ! } |
From: Benoit N. <be...@us...> - 2001-11-07 21:26:13
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Core In directory usw-pr-cvs1:/tmp/cvs-serv11462/ANet_Daemon/Core Modified Files: ModuleLoader.c Log Message: "" Index: ModuleLoader.c =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Core/ModuleLoader.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ModuleLoader.c 2001/10/27 15:44:14 1.1 --- ModuleLoader.c 2001/11/07 21:26:10 1.2 *************** *** 31,32 **** --- 31,33 ---- //store info in list } + UInt32 ANetAddModuleName(ANetModuleInfo *modInfo, char *moduleName) { // TO use the madule structure. } UInt32 ANetAddFunctionMap(ANetModuleInfo *modInfo, ANetFunctionMap *funcMap) { // I am not sure as yet. } \ No newline at end of file |
From: Benoit N. <be...@us...> - 2001-11-06 17:19:27
|
Update of /cvsroot/anet/ANet In directory usw-pr-cvs1:/tmp/cvs-serv8886 Added Files: CONTRIB LICENSE gpl.txt lgpl.txt Log Message: "" --- NEW FILE: CONTRIB --- Current contributors of the ANet project. This list contain names of those who produced copyrighted work in the ANet project. The list will be updated as new people add copyrighted work to the project. Updated: 11/06/01 Benoit Nadeau (Benad): mailto:be...@us..., mailto:be...@ma..., http://homepage.mac.com/benad/ --- NEW FILE: LICENSE --- The software contained in ANet_Client_SDK and ANet_Common is distributed under the LGPL, as described in the document lgpl.txt. The software contained in ANet_Daemon is distributed under the GPL, as described in the document gpl.txt. Note that the code of ANet_Daemon is dependent on the code in ANet_Common, and that both ANet_Daemon and ANet_Common can be redistributed, under authorization of the managers of the ANet project, in a single package under the GPL, at which case derived works of that package will remain under the GPL. The sources of ANet_Client_SDK, ANet_Common and ANet_Daemon are placed on the same directory tree only by "mere aggregation", as defined in the GPL and the LGPL. The documents are Copyrighted by their respective authors, whose names can be found in the documents themselves or in the attached documentation. --- NEW FILE: gpl.txt --- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 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. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, 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 or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's 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 give any other recipients of the Program a copy of this License along with the Program. 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 Program or any portion of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, 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 Program, 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 Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) 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; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, 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 executable. However, as a special exception, the source code 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. If distribution of executable or 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 counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program 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. 5. 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 Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program 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 to this License. 7. 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 Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program 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 Program. 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. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program 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. 9. The Free Software Foundation may publish revised and/or new versions of the 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 Program 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 Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, 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 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 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 Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program 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 of the License, or (at your option) any later version. This program 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. You should have received a copy of the GNU General Public License along with this program; 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. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. --- NEW FILE: lgpl.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! |
From: Benoit N. <be...@us...> - 2001-11-05 23:27:06
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Linux In directory usw-pr-cvs1:/tmp/cvs-serv7895/Linux Added Files: Makefile main.c Log Message: Added linked lists, Makefile, and did some cleanup --- NEW FILE: Makefile --- SHELL = /bin/sh # Add paths to all the headers here. header_paths = -I. -I../Common -I../Core -I../Common/Lists # Change compiler options here compiler = gcc -g ${header_paths} # Add source and header files paths here vpath %.c . vpath %.c ../Common/ vpath %.c ../Common/Lists/ vpath %.c ../Core/ vpath %.h . vpath %.h ../Common/ vpath %.h ../Common/Lists/ vpath %.h ../Core/ # Default rule to compile *.c files. %.o: %.c ${compiler} -c $< -o $@ # Linking target anetd: DoubleLinkedLists.o LinkedLists.o BinaryTrees.o main.o ${compiler} $^ -lm -o anetd # Add files to compile here. # Append file-specific header after the *.c files DoubleLinkedLists.o: DoubleLinkedLists.c LinkedLists.h LinkedLists.o: LinkedLists.c LinkedLists.h BinaryTrees.o: BinaryTrees.c LinkedLists.h main.o: main.c Modules.h # Header dependencies. Neat, no? Modules.h: Memory.h Packets.h XMLCommon.h LinkedLists.h @touch ../Common/Modules.h Packets.h: Memory.h @touch ../Common/Memory.h XMLCommon.h: Memory.h @touch ../Common/XMLCommon.h LinkedLists.h: ANetCommon.h @touch ../Common/Lists/LinkedLists.h # Special targets below. all: test clean: build_clean rm -f anetd build_clean: rm -f *.o .PHONY: all clean build_clean --- NEW FILE: main.c --- #include <stdio.h> #include <stdlib.h> #include "Modules.h" int main(int argc, char **argv) { printf("Starting ANet daemon...\n"); //Do some stuff here... printf("Closing ANet daemon...\n"); return 0; } |
From: Benoit N. <be...@us...> - 2001-11-05 23:27:06
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Common In directory usw-pr-cvs1:/tmp/cvs-serv7895/Common Modified Files: Memory.h Modules.h Packets.h XMLCommon.h Added Files: ANetCommon.h Log Message: Added linked lists, Makefile, and did some cleanup --- NEW FILE: ANetCommon.h --- /****************************************************************** ANet_Daemon/Common/ANetCommon.h Common declarations for the ANet daemon. Part of the ANet project. Distributed under GPL: http://www.gnu.org/copyleft/gpl.html ******************************************************************/ #ifndef ANET_COMMON #define ANET_COMMON #ifndef __MACTYPES__ typedef unsigned char UInt8; typedef signed char SInt8; typedef unsigned short UInt16; typedef signed short SInt16; typedef unsigned long UInt32; typedef signed long SInt32; #define __MACTYPES__ #endif //__MACTYPES__ #endif Index: Memory.h =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Common/Memory.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Memory.h 2001/10/14 23:16:35 1.2 --- Memory.h 2001/11/05 23:27:03 1.3 *************** *** 11,14 **** --- 11,16 ---- #define ANET_MEMORY + #include "ANetCommon.h" + typedef UInt32 ANetMemoryTag; Index: Modules.h =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Common/Modules.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Modules.h 2001/10/27 15:44:14 1.3 --- Modules.h 2001/11/05 23:27:03 1.4 *************** *** 11,19 **** #define ANET_MODULES #include "Memory.h" #include "Packets.h" #include "XMLCommon.h" ! typedef struct { char *name; //Symbol name (can be NULL) UInt32 ID; //Module function ID --- 11,21 ---- #define ANET_MODULES + #include "ANetCommon.h" #include "Memory.h" #include "Packets.h" #include "XMLCommon.h" + #include "LinkedLists.h" ! typedef struct ANetFunctionMap { char *name; //Symbol name (can be NULL) UInt32 ID; //Module function ID *************** *** 88,92 **** typedef UInt32(*ANetClusterFilterMainFuncPtr)(UInt32 nbrPackets, UInt8 *packets, ANetMemoryTag packetsToDelete, ANetMemoryTag connectionsToDelete); ! typedef UInt32(*ANetClusterFilterForcedFuncPtr)(UInt nbrPackets, UInt8 *packets, UInt32 maxBytes, ANetMemoryTag packetsToDelete, ANetMemoryTag connectionsToDelete); --- 90,94 ---- typedef UInt32(*ANetClusterFilterMainFuncPtr)(UInt32 nbrPackets, UInt8 *packets, ANetMemoryTag packetsToDelete, ANetMemoryTag connectionsToDelete); ! typedef UInt32(*ANetClusterFilterForcedFuncPtr)(UInt32 nbrPackets, UInt8 *packets, UInt32 maxBytes, ANetMemoryTag packetsToDelete, ANetMemoryTag connectionsToDelete); Index: Packets.h =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Common/Packets.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Packets.h 2001/10/14 23:16:35 1.2 --- Packets.h 2001/11/05 23:27:03 1.3 *************** *** 11,14 **** --- 11,15 ---- #define ANET_PACKETS + #include "ANetCommon.h" #include "Memory.h" Index: XMLCommon.h =================================================================== RCS file: /cvsroot/anet/ANet/ANet_Daemon/Common/XMLCommon.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XMLCommon.h 2001/10/14 23:16:35 1.3 --- XMLCommon.h 2001/11/05 23:27:03 1.4 *************** *** 11,17 **** #define XML_COMMON #include "Memory.h" ! typedef struct { UInt8 *name; UInt8 *value; --- 11,18 ---- #define XML_COMMON + #include "ANetCommon.h" #include "Memory.h" ! typedef struct ANetAttribute { UInt8 *name; UInt8 *value; *************** *** 19,43 **** typedef struct ANetAttribListItem { ! ANetAttribListItem *next; ANetAttribute attribute; } ANetAttribListItem; - typedef struct ANetTagListItem { - ANetTagListItem *next; - ANetTag tag; - } - typedef struct ANetTag { UInt8 *name; // C string ! ANetTag *parent; void *children; // typecast to ANetTagListItem* ANetAttribListItem *attributes; } ANetTag; typedef UInt32 ANetAttributeID; typedef UInt32 ANetTagID; // TagIDs are used to "hide" the implementation of the XML parser. // Initially, they are all typecasted pointers, but later on ! // they won't point directly to a memory location --- 20,44 ---- typedef struct ANetAttribListItem { ! struct ANetAttribListItem *next; ANetAttribute attribute; } ANetAttribListItem; typedef struct ANetTag { UInt8 *name; // C string ! struct ANetTag *parent; void *children; // typecast to ANetTagListItem* ANetAttribListItem *attributes; } ANetTag; + typedef struct ANetTagListItem { + struct ANetTagListItem *next; + ANetTag tag; + } ANetTagListItem; + typedef UInt32 ANetAttributeID; typedef UInt32 ANetTagID; // TagIDs are used to "hide" the implementation of the XML parser. // Initially, they are all typecasted pointers, but later on ! // they won't point directly to a memory location. |
From: Benoit N. <be...@us...> - 2001-11-05 23:27:06
|
Update of /cvsroot/anet/ANet/ANet_Daemon/Common/Lists In directory usw-pr-cvs1:/tmp/cvs-serv7895/Common/Lists Added Files: BinaryTrees.c DoubleLinkedLists.c LinkedLists.c LinkedLists.h README.txt sample.c Log Message: Added linked lists, Makefile, and did some cleanup --- NEW FILE: BinaryTrees.c --- /* Binary trees. */ #include <stdlib.h> #include "LinkedLists.h" void InsertInTree(BinaryNodePtr theNode, BinaryNodePtr *root, SInt8 (*CompareFunction)(NodePtr a, NodePtr b)) { BinaryNode **curPos = root; while (1) /* Who needs recursion? */ { if (!*curPos) { *curPos = theNode; break; } else if (CompareFunction((NodePtr)(theNode), (NodePtr)(*curPos)) >= 0) { curPos = &((*curPos)->right); } else { curPos = &((*curPos)->left); } } } BinaryNodePtr SortedDoubleToBinaryWithSize(DoubleNodePtr linkedList, UInt32 size) { /* Note: Ignores the "prev" pointers. So, if you want to pass the result of BinaryToDouble to this function, you don't need to call FillPrev first. */ UInt32 halfSize = (size >> 1), counter, sizeA, sizeB; DoubleNodePtr middleNode; sizeA = halfSize; sizeB = halfSize; sizeB -= ((size & 1) ? (0) : (1)); counter = halfSize; middleNode = linkedList; while (counter--) middleNode = middleNode->next; if (sizeB) middleNode->next = /* Or ->right */ (DoubleNodePtr)(SortedDoubleToBinaryWithSize(middleNode->next, sizeB)); else middleNode->next = (DoubleNodePtr)(0); if (sizeA) middleNode->prev = /* Or ->left */ (DoubleNodePtr)(SortedDoubleToBinaryWithSize(linkedList, sizeA)); else middleNode->prev = (DoubleNodePtr)(0); return (BinaryNodePtr)(middleNode); } DoubleNodePtr BinaryToDouble(BinaryNodePtr root, UInt8 fillPrev) { IndirectNodePtr list; DoubleNodePtr doubleList; LeftNodeRight(root, &list); ApplyIndirectOnSimple(list); if (fillPrev) FillPrev((DoubleNodePtr)(list->nodePtr)); doubleList = (DoubleNodePtr)(list->nodePtr); DestroyLinkedList((NodePtr)(list), DestroyIndirectNode); return doubleList; } IndirectNodePtr* LeftNodeRight(BinaryNodePtr node, IndirectNodePtr *theList) { /* Used only for the BinaryToDouble function. */ IndirectNodePtr newNode = malloc(sizeof(IndirectNode)); if (node->left) theList = LeftNodeRight(node->left, theList); newNode->nodePtr = (NodePtr)(node); newNode->nodeHeader.next = (NodePtr)(0); *theList = newNode; theList = (IndirectNodePtr*)(&newNode->nodeHeader.next); if (node->right) theList = LeftNodeRight(node->right, theList); return theList; } void BalanceTree(BinaryNodePtr *root) { DoubleNodePtr doubleList = BinaryToDouble(*root, 0); *root = SortedDoubleToBinary(doubleList); /* It's that small! Wow! */ } --- NEW FILE: DoubleLinkedLists.c --- /* Double linked lists. */ #include <stdlib.h> #include "LinkedLists.h" void InvertDoubleList(DoubleNodePtr *doubleLinkedListPtr) { /* Same as InvertList, but for double linked lists, and much faster. */ DoubleNodePtr curNode = *doubleLinkedListPtr, copyPtr; while (1) { copyPtr = curNode->next; curNode->next = curNode->prev; curNode->prev = copyPtr; if (!copyPtr) break; curNode = copyPtr; } *doubleLinkedListPtr = curNode; } UInt32 FindFirst(DoubleNodePtr linkedList, DoubleNodePtr* first) { /* Same as FindLast, but backwards with a double linked list. */ DoubleNodePtr curNode; UInt32 nbrNodes = 0; for (curNode = linkedList; curNode->prev; curNode = curNode->prev) nbrNodes++; if (first) *first = curNode; return (nbrNodes + 1); } void FillPrev(DoubleNodePtr linkedList) { /* Fills the 'prev' values based on the single linked list given by the 'next' values. */ DoubleNodePtr prev = NULL, curNode = linkedList; while (curNode) { curNode->prev = prev; prev = curNode; curNode = curNode->next; } } --- NEW FILE: LinkedLists.c --- /* Single and indirect linked lists.*/ #include <stdlib.h> #include <math.h> #include "LinkedLists.h" UInt32 DestroyLinkedList(NodePtr linkedList, UInt8 (*DestructorFunction)(NodePtr theNode)) { /* Destroys all elements in a linked list pointed by "linkedList". The destructor function must destroy the node and return 0 only if no error occured. Returns the number of nodes successfully destroyed. */ NodePtr curNode, copyPtr; UInt32 nbrDestroyed = 0; if (!DestructorFunction) return 0; for (curNode = linkedList; curNode;) { copyPtr = curNode->next; if (DestructorFunction(curNode)) return nbrDestroyed; nbrDestroyed++; curNode = copyPtr; } return nbrDestroyed; } UInt8 DestroyIndirectNode(NodePtr theNode) { free((IndirectNodePtr)(theNode)); return (!theNode); } UInt32 FindLast(NodePtr linkedList, NodePtr* last) { /* Sets "*last" to point at the last node of the linked lisk pointed by "linkedList", unless "last" is NULL. Returns the numbers of nodes in the list. You can also use the macro function "NbrNodes(NodePtr linkedList);". */ NodePtr curNode; UInt32 nbrNodes = 0; for (curNode = linkedList; curNode->next; curNode = curNode->next) nbrNodes++; if (last) *last = curNode; return (nbrNodes + 1); } NodePtr GetNthNode(NodePtr linkedList, UInt32 n) { /* Returns a pointer to the Nth node of the linked list, the first node being node 0 (the 0th node?), as with arrays. */ NodePtr curNode = linkedList; while ( (n--) && (curNode) ) curNode = curNode->next; return curNode; } NodePtr SplitAtNth(NodePtr linkedList, UInt32 n) { /* Splits the linked list pointed by "linkedList" into 2 linked lists after node "n", the first node being node 0, as with arrays. Returns a pointer to the beginning of the second linked list. */ UInt32 curPos = 0; NodePtr curNode, copyPtr; for (curNode = linkedList; (++curPos) != n; curNode = curNode->next) { if (!curPos) return NULL; } copyPtr = curNode->next; curNode->next = NULL; return copyPtr; } IndirectNodePtr FindAndList(NodePtr linkedList, UInt8 (*IsWhatIWant)(NodePtr theNode)) { /* Using the key function "IsWhatIWant", makes a new indirect list (made of indirect nodes) that lists pointers to found nodes. They are listed in the order that they were found. Call "DestroyLinkedList((Node*)(returnedIndirectList), DestroyIndirectNode);" to destroy the indirect linked list returned by this function. */ NodePtr curNode; IndirectNodePtr foundList = NULL, lastInFoundList = NULL; if (!IsWhatIWant) return NULL; for(curNode = linkedList; curNode; curNode = curNode->next) { if (IsWhatIWant(curNode)) { IndirectNodePtr newNode = malloc(sizeof(IndirectNode)); newNode->nodePtr = curNode; if (!foundList) { foundList = newNode; lastInFoundList = newNode; } else { lastInFoundList->nodeHeader.next = (Node*)(newNode); lastInFoundList = newNode; } lastInFoundList->nodeHeader.next = NULL; } } return foundList; } NodePtr FindAndMoveOut(NodePtr *linkedListPtr, UInt8 (*IsWhatIWant)(NodePtr theNode)) { /* Does the same thing as "FindAndList", but also removes all found nodes and places them in a new single linked list, which is the returned value. */ NodePtr *curNodePtrPtr, newList; IndirectNodePtr foundList = FindAndList(*linkedListPtr, IsWhatIWant), curIndirect; if (!foundList) return NULL; curIndirect = foundList; for(curNodePtrPtr = linkedListPtr; *curNodePtrPtr;) { if (*curNodePtrPtr == curIndirect->nodePtr) { *curNodePtrPtr = (*curNodePtrPtr)->next; /* Searching for next one */ curIndirect = (IndirectNodePtr)(curIndirect->nodeHeader.next); if (!curIndirect) break; } else { curNodePtrPtr = &((*curNodePtrPtr)->next); } } ApplyIndirectOnSimple(foundList); newList = foundList->nodePtr; /* Destroying temporary indirect linked list... */ DestroyLinkedList((Node*)(foundList), DestroyIndirectNode); return newList; } void ApplyIndirectOnSimple(IndirectNodePtr indirectList) { /* Applies the indirect linked list on the single list. This means that if an indirect node IndB, that points to node B, is after the indirect node IndA, that points to node A, in the indirect linked list, then this function will make node B be after node A in the single linked list. */ IndirectNodePtr curIndirect; for (curIndirect = indirectList; curIndirect->nodeHeader.next; curIndirect = (IndirectNodePtr)(curIndirect->nodeHeader.next)) { curIndirect->nodePtr->next = ((IndirectNodePtr)(curIndirect->nodeHeader.next))->nodePtr; } /* Do the last one. Otherwise ((IndirectNodePtr)(curIndirect->nodeHeader.next))->nodePtr */ /* is just junk from *NULL... */ curIndirect->nodePtr->next = NULL; } void InvertList(NodePtr *linkedListPtr) { /* Inverts the list pointed by *linkedListPtr. So, a->b->c becomes c->b->a. If you plan to do this often, use InvertDoubleList with a double linked list, as it's much faster. */ NodePtr newList, lastNode; UInt32 nbrNodes = NbrNodes(*linkedListPtr), curNth; if (nbrNodes < 2) return; lastNode = newList = GetNthNode(*linkedListPtr, nbrNodes-1); for (curNth = (nbrNodes - 2); curNth; curNth--) { lastNode->next = GetNthNode(*linkedListPtr, curNth); lastNode = lastNode->next; } /* Add the last one. */ lastNode->next = *linkedListPtr; (*linkedListPtr)->next = NULL; *linkedListPtr = newList; } void SplitAndMergeSort(NodePtr *linkedList, SInt8 (*CompareFunction)(NodePtr a, NodePtr b)) { /* Given a pointer to the beginning of a linked list and a compare function, this function sorts the list using the "split-merge" algorythm. CompareFunction(NodePtr a, NodePtr b) should return a value < 1 if and only if a is smaller than b. */ Node empty; NodePtr listA, listB, curNode = &empty, newList = ∅ UInt32 nbrNodesFullList = NbrNodes(*linkedList); /* Split... */ listA = *linkedList; listB = SplitAtNth(listA, nbrNodesFullList/2); /* ...(sorting)... */ if (floor((double)(nbrNodesFullList)/2) > 1) /* Size of listA */ SplitAndMergeSort(&listA, CompareFunction); if (ceil((double)(nbrNodesFullList)/2) > 1) /* Size of listB */ SplitAndMergeSort(&listB, CompareFunction); /* ... and Merge */ while (listA && listB) { if (CompareFunction(listA, listB) < 0) { /* listA is smaller than listB */ curNode->next = listA; curNode = curNode->next; listA = listA->next; } else { /* listB is smaller or equal to listA */ curNode->next = listB; curNode = curNode->next; listB = listB->next; } } while (listA) { curNode->next = listA; curNode = curNode->next; listA = listA->next; } while (listB) { curNode->next = listB; curNode = curNode->next; listB = listB->next; } newList = newList->next; *linkedList = newList; } --- NEW FILE: LinkedLists.h --- #ifndef __BENAD_LINKED_LISTS__ #define __BENAD_LINKED_LISTS__ #ifndef __MACTYPES__ /* This is assuming that: char = 8 bits, short = 16 bits and long = 32 bits. If this is false, just change those typedefs correctly. */ typedef unsigned char UInt8; typedef signed char SInt8; typedef unsigned short UInt16; typedef signed short SInt16; typedef unsigned long UInt32; typedef signed long SInt32; #endif /* #ifndef __MACTYPES__ */ typedef struct Node { struct Node* next; } Node, *NodePtr; typedef struct IndirectNode { Node nodeHeader; NodePtr nodePtr; } IndirectNode, *IndirectNodePtr; typedef struct DoubleNode { struct DoubleNode* next; struct DoubleNode* prev; } DoubleNode, *DoubleNodePtr; typedef struct BinaryNode { struct BinaryNode* right; struct BinaryNode* left; } BinaryNode, *BinaryNodePtr; UInt32 DestroyLinkedList(NodePtr linkedList, UInt8 (*DestructorFunction)(NodePtr theNode)); UInt32 FindLast(NodePtr linkedList, NodePtr* last); #define NbrNodes(linkedList) FindLast(linkedList, NULL) NodePtr GetNthNode(NodePtr linkedList, UInt32 n); NodePtr SplitAtNth(NodePtr linkedList, UInt32 n); IndirectNodePtr FindAndList(NodePtr linkedList, UInt8 (*IsWhatIWant)(NodePtr theNode)); NodePtr FindAndMoveOut(NodePtr *linkedListPtr, UInt8 (*IsWhatIWant)(NodePtr theNode)); void ApplyIndirectOnSimple(IndirectNodePtr indirectList); void InvertList(NodePtr *linkedListPtr); void SplitAndMergeSort(NodePtr *linkedList, SInt8 (*CompareFuntion)(NodePtr a, NodePtr b)); void InvertDoubleList(DoubleNodePtr *doubleLinkedListPtr); UInt32 FindFirst(DoubleNodePtr linkedList, DoubleNodePtr* first); void FillPrev(DoubleNodePtr linkedList); void InsertInTree(BinaryNodePtr theNode, BinaryNodePtr *root, SInt8 (*CompareFunction)(NodePtr a, NodePtr b)); BinaryNodePtr SortedDoubleToBinaryWithSize(DoubleNodePtr linkedList, UInt32 size); #define SortedDoubleToBinary(l) SortedDoubleToBinaryWithSize(l, NbrNodes((NodePtr)(l))); DoubleNodePtr BinaryToDouble(BinaryNodePtr root, UInt8 fillPrev); IndirectNodePtr* LeftNodeRight(BinaryNodePtr node, IndirectNodePtr *theList); void BalanceTree(BinaryNodePtr *root); UInt8 DestroyIndirectNode(NodePtr theNode); #endif /* #ifndef __BENAD_LINKED_LISTS__ */ --- NEW FILE: README.txt --- Benad's Linked Lists is now distributed under GPL. 'Nuff said. --- NEW FILE: sample.c --- /* Benad's linked lists. Simple, fast linked lists. That's it. WARNING: Using a broken linked list with any of those functions may crash your computer, and/or do something crazy with it. I tested my functions enough to know that if that happens, it's not MY fault... */ #include <stdio.h> #include <stdlib.h> #include "LinkedLists.h" UInt8 SimpleDestructor(NodePtr theNode); UInt8 SimpleIsWhatIWant(NodePtr theNode); SInt8 SimpleCompare(NodePtr a, NodePtr b); int main(int argc, char **argv) { DoubleNodePtr a, b, c, list; /*NodePtr found;*/ /*BinaryNodePtr binaryTree, newVal;*/ UInt32 nbr; a = malloc(sizeof(DoubleNode)); b = malloc(sizeof(DoubleNode)); c = malloc(sizeof(DoubleNode)); a->next = b; a->prev = NULL; b->next = c; b->prev = NULL; c->next = NULL; c->prev = NULL; list = a; nbr = NbrNodes((NodePtr)(a)); SplitAndMergeSort((NodePtr*)(&list), SimpleCompare); /*FillPrev(list);*/ /*binaryTree = SortedDoubleToBinary(list);*/ /*newVal = malloc(sizeof(BinaryNode)); newVal->left = newVal->right = (BinaryNodePtr)(0); InsertInTree(newVal, &binaryTree, SimpleCompare);*/ BalanceTree((BinaryNodePtr*)(&list)); /*List is like fully unbalanced tree*/ /*if (SplitAtNth(a, 2) != c) return 1;*/ /*if (GetNthNode(a, 2) != c) return 1; found = FindAndMoveOut(&a, SimpleIsWhatIWant); nbr = NbrNodes(found); if (DestroyLinkedList(found, SimpleDestructor) != nbr) /* ACK! Error! */ /* return 1;*/ /*InvertList(&list);*/ /*SplitAndMergeSort(&(NodePtr)(list), SimpleCompare);*/ /*InvertDoubleList(&list);*/ return 0; } UInt8 SimpleDestructor(NodePtr theNode) { free(theNode); return (!theNode); } UInt8 SimpleIsWhatIWant(NodePtr theNode) { return (UInt8)(theNode); } SInt8 SimpleCompare(NodePtr a, NodePtr b) { return (a-b); } |