erikeldridge / curlyqueue Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/curlyqueue
Automatically exported from code.google.com/p/curlyqueue
=Introduction Curly queue is a simple queue implemented in C. It uses a doubly-linked list for the back-end storage and offers the following (public) functions: - create_queue - destroy_queue - is_empty - enqueue - dequeue - iterator_has_next - iterator_has_prev - iterarator_jump_to_front - iterator_jump_to_back - get_value_at_iterator - insert_value_before_iterator (I know!) - insert_value_after_iterator - delete_value_at_iterator Yes, you read right, this is a queue manager with arbitrary insert and delete; it's the Curly queue! Use this code as you like, no need to give credit. Please refer to the license for the nitty-gritty licensing details. =Installation 1) unpack the archive a) >tar zxvf curlyqueue-x.x.x.tar.gz 2) go into the new curlyqueue-x.x.x directory a) >cd curlyqueue-x.x.x 3) run make to compile the queue a) >make This results in a static library named libcurlyqueue.a in the curlyqueue-x.x.x directory =Usage 1) Refer to the API given in the documentation in the docs directory for a list of available functions a) In your web browser, open curlyqueue-x.x.x/docs/html/index.html b) Click on the "files" tab and follow the "curlyqueue.h" link to the "curlyqueue.h File Reference" c) Scroll down to the "Functions" section 2) Call any of these functions in your program a) Remember to include the curlyqueue.h header file in your program b) For example, let this be the content of a file "hello_queue.c" located in the same directory as the curlyqueue-x.x.x directory: #include "curlyqueue-x.x.x/curlyqueue.h" #include "stdio.h" int main(){ // create a queue curlyqueue_t* queue = curlyqueue_create_queue(); // put something in it int i = 100; void *value = &i; curlyqueue_enqueue( queue, value ); // pop it back out. {except_t e;e.thrown=0; value = curlyqueue_dequeue( queue, &e ); //assume no exception thrown //Note: the docs give info on except_t } // print it printf( "%d \n", *(int *)value ); // kill the queue curlyqueue_destroy_queue( queue ); return 0; } 3) Compile your program and run it a) >gcc hello_queue.c curlyqueue-x.x.x/libcurlyqueue.a -o hello_queue b) >./hello_queue >100 4) More examples of usage can be found in the unit tests in the tests directory =The license The MIT License Copyright (c) 2008 Erik Eldridge Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.