Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit e33eb4014116f91d574ec054dfef7ef80441ae5d @Maher4Ever committed Jul 11, 2012
Showing with 1,336 additions and 0 deletions.
  1. +191 −0 .gitignore
  2. +4 −0 Gemfile
  3. +22 −0 LICENSE
  4. +53 −0 README.md
  5. +6 −0 Rakefile
  6. +13 −0 example/changes_monitor.rb
  7. +44 −0 ext/wdm/buffer.h
  8. +66 −0 ext/wdm/entry.c
  9. +45 −0 ext/wdm/entry.h
  10. +7 −0 ext/wdm/extconf.rb
  11. +40 −0 ext/wdm/global.h
  12. +67 −0 ext/wdm/monitor.c
  13. +49 −0 ext/wdm/monitor.h
  14. +93 −0 ext/wdm/queue.c
  15. +48 −0 ext/wdm/queue.h
  16. +366 −0 ext/wdm/wdm.c
  17. +41 −0 ext/wdm/wdm.h
  18. +20 −0 ext/wdm/wdm.sln
  19. +94 −0 ext/wdm/wdm.vcxproj
  20. +48 −0 ext/wdm/wdm.vcxproj.filters
  21. +19 −0 wdm.gemspec
@@ -0,0 +1,191 @@
+# -------------------------------------
+# Added by 'bundle gem ...'
+# -------------------------------------
+*.gem
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
+coverage
+doc/
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
+
+# -----------------------------------------------------------------
+# The following rules are from: https://github.com/github/gitignore
+# -----------------------------------------------------------------
+
+# -------------------------------------
+# Global/Windows.gitignore
+# -------------------------------------
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# -------------------------------------
+# Global/VisualStudio.gitignore
+# -------------------------------------
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug*/
+[Rr]elease/
+
+build/
+
+
+[Tt]est[Rr]esult
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+*.vssscc
+.builds
+
+*.pidb
+
+*.log
+*.scc
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+
+*.[Rr]e[Ss]harper
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Publish Web Output
+*.Publish.xml
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+[Tt]est[Rr]esult*
+*.Cache
+ClientBin
+[Ss]tyle[Cc]op.*
+~$*
+*.dbmdl
+
+*.[Pp]ublish.xml
+
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+# NuGet
+packages/
+
+# -------------------------------------
+# C.gitignore
+# -------------------------------------
+
+# Object files
+*.o
+
+# Libraries
+*.lib
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+
+# Executables
+*.exe
+*.out
+
+# -------------------------------------
+# Ruby.gitignore
+# -------------------------------------
+
+*.gem
+*.rbc
+.bundle
+.config
+coverage
+InstalledFiles
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
+
+# YARD artifacts
+.yardoc
+_yardoc
+doc/
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in wdm.gemspec
+gemspec
22 LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Maher Sallam
+
+MIT License
+
+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.
@@ -0,0 +1,53 @@
+# Wdm
+
+Windows Directory Monitor (WDM) is a library which can be used to monitor directories for changes.
+It's mostly implemented in C and uses the Win32 API for a better performance.
+
+**Note:** This is still a work in progress, so it's not advisable to use
+it yet in anything (unless you are testing it, which is very much appreciated :)).
+
+TODO:
+
+- Fix all the TODO's in the source.
+- Add options to the `watch` method.
+- Provide info about the change in the callback.
+
+## Installation
+
+Add this line to your application's Gemfile:
+
+ gem 'wdm'
+
+And then execute:
+
+ $ bundle
+
+Or install it yourself as:
+
+ $ gem install wdm
+
+## Compiling the extension for developers
+
+Download the source, then run the following:
+
+ $ rake compile
+
+To get debug messages, you need to enable them in the `global.h` file:
+
+ #define WDM_DEBUG_ENABLED TRUE // This is disabled by default
+
+## Usage
+
+TODO: Write usage instructions here
+
+## Contributing
+
+1. Fork it
+2. Create your feature branch (`git checkout -b my-new-feature`)
+3. Commit your changes (`git commit -am 'Added some feature'`)
+4. Push to the branch (`git push origin my-new-feature`)
+5. Create new Pull Request
+
+## Author
+
+[Maher Sallam](https://github.com/Maher4Ever)
@@ -0,0 +1,6 @@
+#!/usr/bin/env rake
+require 'bundler/gem_tasks'
+require 'rake/extensiontask'
+
+# Compile the extension
+Rake::ExtensionTask.new('wdm')
@@ -0,0 +1,13 @@
+require_relative '../lib/wdm'
+
+monitor = WDM::Monitor.new
+monitor.watch('C:\Users\Maher\Desktop\test') { puts "change 1!" }
+monitor.watch('C:\Users\Maher\Desktop\psds') { puts "change 2!" }
+
+thread = Thread.new {
+ monitor.run!
+}
+
+sleep(10)
+
+monitor.stop
@@ -0,0 +1,44 @@
+#include <Windows.h>
+
+#ifndef WDM_BUFFER_H
+#define WDM_BUFFER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+
+
+// ---------------------------------------------------------
+// Types
+// ---------------------------------------------------------
+
+typedef LPBYTE WDM_PBuffer;
+
+typedef struct WDM_Queue {
+ WDM_PQueueItem front;
+ WDM_PQueueItem rear;
+} WDM_Queue, *WDM_PQueue;
+
+// ---------------------------------------------------------
+// Prototypes
+// ---------------------------------------------------------
+
+WDM_PQueueItem wdm_queue_item_new();
+void wdm_queue_item_free(WDM_PQueueItem);
+
+WDM_PQueue wdm_queue_new();
+void wdm_queue_free(WDM_PQueue);
+
+void wdm_queue_enqueue(WDM_PQueue, WDM_PQueueItem);
+WDM_PQueueItem wdm_queue_dequeue(WDM_PQueue);
+void wdm_queue_empty(WDM_PQueue);
+BOOL wdm_queue_is_empty(WDM_PQueue);
+
+// ---------------------------------------------------------
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // WDM_BUFFER_H
Oops, something went wrong.

0 comments on commit e33eb40

Please sign in to comment.