├── .gitattributes ├── README.md ├── WDL ├── .gitattributes ├── MersenneTwister.h ├── adpcm_decode.h ├── adpcm_encode.h ├── assocarray.h ├── audiobuffercontainer.cpp ├── audiobuffercontainer.h ├── bitfield.h ├── blowfish.c ├── blowfish.h ├── chunkalloc.h ├── circbuf.h ├── cmath │ ├── bessel_polynomial.h │ ├── complex_number.h │ ├── custom_math.h │ ├── durand_kerner.h │ ├── factorial.h │ ├── horner.h │ ├── test_bessel.c │ └── test_eval.c ├── convoengine.cpp ├── convoengine.h ├── db2val.h ├── denormal.h ├── des.cpp ├── des.h ├── destroycheck.h ├── diffcalc.h ├── dirscan.h ├── eel2 │ ├── .gitignore │ ├── Makefile │ ├── a2i.php │ ├── a2x64.php │ ├── asm-nseel-aarch64-gcc.c │ ├── asm-nseel-arm-gcc.c │ ├── asm-nseel-ppc-gcc.c │ ├── asm-nseel-x64-macho.o │ ├── asm-nseel-x64.obj │ ├── asm-nseel-x86-gcc.c │ ├── asm-nseel-x86-msvc.c │ ├── eel2.l │ ├── eel2.vim │ ├── eel2.y │ ├── eel_atomic.h │ ├── eel_eval.h │ ├── eel_fft.h │ ├── eel_files.h │ ├── eel_import.h │ ├── eel_lice.h │ ├── eel_mdct.h │ ├── eel_misc.h │ ├── eel_net.h │ ├── eel_strings.h │ ├── eelscript.h │ ├── gen-lex-yacc │ ├── glue_aarch64.h │ ├── glue_arm.h │ ├── glue_port.h │ ├── glue_port_new.h │ ├── glue_ppc.h │ ├── glue_x86.h │ ├── glue_x86_64.h │ ├── loose_eel.cpp │ ├── loose_eel.dsp │ ├── loose_eel.dsw │ ├── loose_eel.sln │ ├── loose_eel.vcxproj │ ├── loose_eel.vcxproj.filters │ ├── makefile.vc │ ├── ns-eel-addfuncs.h │ ├── ns-eel-func-ref.h │ ├── ns-eel-int.h │ ├── ns-eel.h │ ├── nseel-caltab.c │ ├── nseel-cfunc.c │ ├── nseel-compiler.c │ ├── nseel-eval.c │ ├── nseel-lextab.c │ ├── nseel-ram.c │ ├── nseel-yylex.c │ ├── scripts │ │ ├── circle.eel │ │ ├── eval_test.eel │ │ ├── gfx_test.eel │ │ ├── gfx_test_defer.eel │ │ ├── httpd.eel │ │ ├── sinewave_text.eel │ │ └── space.eel │ ├── y.tab.c │ └── y.tab.h ├── fastqueue.h ├── ffmpeg.h ├── fft.c ├── fft.h ├── filebrowse.cpp ├── filebrowse.h ├── filename.h ├── fileread.h ├── filewrite.h ├── fnv64.h ├── giflib │ ├── AUTHORS │ ├── COPYING │ ├── ChangeLog │ ├── DEVELOPERS │ ├── README │ ├── config.h │ ├── dgif_lib.c │ ├── egif_lib.c │ ├── gif_hash.c │ ├── gif_hash.h │ ├── gif_lib.h │ ├── gif_lib_private.h │ └── gifalloc.c ├── gpu │ ├── gpu.cpp │ ├── gpu.h │ └── wglext.h ├── has_strings.h ├── heapbuf.h ├── history.txt ├── jnetlib │ ├── Makefile │ ├── asyncdns.cpp │ ├── asyncdns.h │ ├── connection.cpp │ ├── connection.h │ ├── httpget.cpp │ ├── httpget.h │ ├── httpserv.cpp │ ├── httpserv.h │ ├── irc_util.h │ ├── jnetlib.h │ ├── listen.cpp │ ├── listen.h │ ├── netinc.h │ ├── test.cpp │ ├── test.dsp │ ├── test.dsw │ ├── testbnc.cpp │ ├── util.cpp │ ├── util.h │ ├── webserver.cpp │ └── webserver.h ├── jpeglib │ ├── README │ ├── example.c │ ├── jcapimin.c │ ├── jcapistd.c │ ├── jccoefct.c │ ├── jccolor.c │ ├── jcdctmgr.c │ ├── jchuff.c │ ├── jchuff.h │ ├── jcinit.c │ ├── jcmainct.c │ ├── jcmarker.c │ ├── jcmaster.c │ ├── jcomapi.c │ ├── jconfig.h │ ├── jcparam.c │ ├── jcphuff.c │ ├── jcprepct.c │ ├── jcsample.c │ ├── jctrans.c │ ├── jdapimin.c │ ├── jdapistd.c │ ├── jdatadst.c │ ├── jdatasrc.c │ ├── jdcoefct.c │ ├── jdcolor.c │ ├── jdct.h │ ├── jddctmgr.c │ ├── jdhuff.c │ ├── jdhuff.h │ ├── jdinput.c │ ├── jdmainct.c │ ├── jdmarker.c │ ├── jdmaster.c │ ├── jdmerge.c │ ├── jdphuff.c │ ├── jdpostct.c │ ├── jdsample.c │ ├── jdtrans.c │ ├── jerror.c │ ├── jerror.h │ ├── jfdctflt.c │ ├── jfdctfst.c │ ├── jfdctint.c │ ├── jidctflt.c │ ├── jidctfst.c │ ├── jidctint.c │ ├── jidctred.c │ ├── jinclude.h │ ├── jmemmgr.c │ ├── jmemnobs.c │ ├── jmemsys.h │ ├── jmorecfg.h │ ├── jpegint.h │ ├── jpeglib.h │ ├── jquant1.c │ ├── jquant2.c │ ├── jutils.c │ └── jversion.h ├── lameencdec.cpp ├── lameencdec.h ├── libpng │ ├── CHANGES │ ├── LICENSE │ ├── README │ ├── png.c │ ├── png.h │ ├── pngconf.h │ ├── pngdebug.h │ ├── pngerror.c │ ├── pngget.c │ ├── pnginfo.h │ ├── pnglibconf.h │ ├── pnglibconf.h.prebuilt │ ├── pngmem.c │ ├── pngpread.c │ ├── pngpriv.h │ ├── pngread.c │ ├── pngrio.c │ ├── pngrtran.c │ ├── pngrutil.c │ ├── pngset.c │ ├── pngstruct.h │ ├── pngtest.c │ ├── pngtrans.c │ ├── pngwio.c │ ├── pngwrite.c │ ├── pngwtran.c │ └── pngwutil.c ├── lice │ ├── curverasterbuffer.h │ ├── glew │ │ ├── include │ │ │ └── GL │ │ │ │ ├── WGLEXT.H │ │ │ │ ├── glew.h │ │ │ │ ├── glxew.h │ │ │ │ └── wglew.h │ │ └── src │ │ │ ├── glew.c │ │ │ ├── glewinfo.c │ │ │ └── visualinfo.c │ ├── lice.cpp │ ├── lice.dsp │ ├── lice.dsw │ ├── lice.h │ ├── lice.vcxproj │ ├── lice_arc.cpp │ ├── lice_bezier.h │ ├── lice_bmp.cpp │ ├── lice_colorspace.cpp │ ├── lice_combine.h │ ├── lice_extended.h │ ├── lice_gif.cpp │ ├── lice_gif_write.cpp │ ├── lice_gl_ctx.cpp │ ├── lice_gl_ctx.h │ ├── lice_glbitmap.cpp │ ├── lice_glbitmap.h │ ├── lice_ico.cpp │ ├── lice_image.cpp │ ├── lice_import.h │ ├── lice_jpg.cpp │ ├── lice_jpg_write.cpp │ ├── lice_lcf.cpp │ ├── lice_lcf.h │ ├── lice_line.cpp │ ├── lice_lvg.cpp │ ├── lice_palette.cpp │ ├── lice_pcx.cpp │ ├── lice_png.cpp │ ├── lice_png_write.cpp │ ├── lice_svg.cpp │ ├── lice_texgen.cpp │ ├── lice_text.cpp │ ├── lice_text.h │ ├── lice_textnew.cpp │ └── test │ │ ├── Controller.h │ │ ├── Controller.mm │ │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ └── MainMenu.nib │ │ │ ├── classes.nib │ │ │ ├── info.nib │ │ │ └── keyedobjects.nib │ │ ├── Info.plist │ │ ├── Makefile │ │ ├── fly.cpp │ │ ├── image.png │ │ ├── imgs2gif.cpp │ │ ├── main.cpp │ │ ├── main.ico │ │ ├── main.m │ │ ├── resource.h │ │ ├── test.dsp │ │ ├── test.rc │ │ ├── test.sln │ │ ├── test.vcxproj │ │ ├── test.vcxproj.filters │ │ └── test.xcodeproj │ │ └── project.pbxproj ├── lineparse.h ├── mergesort.h ├── mp3write.h ├── mutex.h ├── nsv │ ├── nsvbs.h │ ├── nsvlib.cpp │ └── nsvlib.h ├── pcmfmtcvt.h ├── plush2 │ ├── pl_cam.cpp │ ├── pl_make.cpp │ ├── pl_math.cpp │ ├── pl_obj.cpp │ ├── pl_pf_tex.h │ ├── pl_putface.cpp │ ├── pl_read_3ds.cpp │ ├── pl_read_cob.cpp │ ├── pl_read_jaw.cpp │ ├── pl_spline.cpp │ ├── plush.h │ └── plush2.dsp ├── poollist.h ├── projectcontext.cpp ├── projectcontext.h ├── ptrlist.h ├── ptrlist_indexed.h ├── queue.h ├── reminder.h ├── resample.cpp ├── resample.h ├── rfb_client.cpp ├── rfb_client.h ├── rng.cpp ├── rng.h ├── rpool.h ├── sc_bounce │ ├── index.html │ ├── info.php │ ├── stream-config.php │ └── stream.php ├── scsrc.cpp ├── scsrc.h ├── setthreadname.h ├── sha.cpp ├── sha.h ├── sharedpool.h ├── shm_connection.cpp ├── shm_connection.h ├── shm_msgreply.cpp ├── shm_msgreply.h ├── simple_pitchshift.h ├── simple_pitchshift2.h ├── sinewavegen.h ├── stringpool.h ├── swell │ ├── Makefile │ ├── commctrl.h │ ├── mac_resgen.php │ ├── sample_project │ │ ├── English.lproj │ │ │ ├── InfoPlist.strings │ │ │ └── MainMenu.xib │ │ ├── Info.plist │ │ ├── app_main.cpp │ │ ├── main.h │ │ ├── main.m │ │ ├── main_dialog.cpp │ │ ├── resource.h │ │ ├── sample_project.dsp │ │ ├── sample_project.dsw │ │ ├── sample_project.rc │ │ ├── sample_project.xcodeproj │ │ │ ├── TemplateIcon.icns │ │ │ └── project.pbxproj │ │ ├── sample_project_Prefix.pch │ │ ├── test_UTF16LE.rc │ │ ├── test_UTF8_LF.rc │ │ └── version.plist │ ├── shlobj.h │ ├── swell-appstub-generic.cpp │ ├── swell-appstub.mm │ ├── swell-dlg-generic.cpp │ ├── swell-dlg.mm │ ├── swell-dlggen.h │ ├── swell-functions.h │ ├── swell-gdi-generic.cpp │ ├── swell-gdi-internalpool.h │ ├── swell-gdi-lice.cpp │ ├── swell-gdi.mm │ ├── swell-generic-gdk.cpp │ ├── swell-generic-headless.cpp │ ├── swell-ini.cpp │ ├── swell-internal.h │ ├── swell-kb-generic.cpp │ ├── swell-kb.mm │ ├── swell-menu-generic.cpp │ ├── swell-menu.mm │ ├── swell-menugen.h │ ├── swell-misc-generic.cpp │ ├── swell-misc.mm │ ├── swell-miscdlg-generic.cpp │ ├── swell-miscdlg.mm │ ├── swell-modstub-generic.cpp │ ├── swell-modstub.mm │ ├── swell-types.h │ ├── swell-wnd-generic.cpp │ ├── swell-wnd.mm │ ├── swell.cpp │ ├── swell.h │ ├── swellappmain.h │ ├── swellappmain.mm │ ├── test.cpp │ └── windows.h ├── time_precise.h ├── timing.c ├── timing.h ├── tinyxml │ ├── libxml_tinyxml.cpp │ ├── libxml_tinyxml.h │ ├── svgtiny_colors.c │ ├── tinystr.cpp │ ├── tinystr.h │ ├── tinyxml.cpp │ ├── tinyxml.h │ ├── tinyxmlerror.cpp │ └── tinyxmlparser.cpp ├── verbengine.h ├── vorbisencdec.h ├── wavwrite.h ├── wdl_base64.h ├── wdlatomic.h ├── wdlcstring.h ├── wdlstring.h ├── wdltypes.h ├── wdlutf8.h ├── win32_curses │ ├── curses.h │ ├── curses_editor.cpp │ ├── curses_editor.h │ ├── curses_win32.cpp │ ├── eel_edit.cpp │ ├── eel_edit.h │ └── test.cpp ├── win32_helpers.h ├── win32_hidpi.h ├── win32_printf.h ├── win32_utf8.c ├── win32_utf8.h ├── win7filedialog.cpp ├── win7filedialog.h ├── wingui │ ├── dlgitemborder.h │ ├── membitmap.h │ ├── richeditctrl.h │ ├── scrollbar │ │ ├── coolscroll.cpp │ │ └── coolscroll.h │ ├── virtwnd-controls.h │ ├── virtwnd-iaccessible.cpp │ ├── virtwnd-iconbutton.cpp │ ├── virtwnd-listbox.cpp │ ├── virtwnd-nsaccessibility.mm │ ├── virtwnd-skin.h │ ├── virtwnd-slider.cpp │ ├── virtwnd.cpp │ ├── virtwnd.h │ ├── wndsize.cpp │ └── wndsize.h ├── xmlparse.h ├── xmlparse_test.cpp ├── xsrand.h └── zlib │ ├── adler32.c │ ├── compress.c │ ├── crc32.c │ ├── crc32.h │ ├── deflate.c │ ├── deflate.h │ ├── gzclose.c │ ├── gzguts.h │ ├── gzlib.c │ ├── gzread.c │ ├── gzwrite.c │ ├── infback.c │ ├── inffast.c │ ├── inffast.h │ ├── inffixed.h │ ├── inflate.c │ ├── inflate.h │ ├── inftrees.c │ ├── inftrees.h │ ├── ioapi.c │ ├── ioapi.h │ ├── trees.c │ ├── trees.h │ ├── uncompr.c │ ├── unzip.c │ ├── unzip.h │ ├── zconf.h │ ├── zip.c │ ├── zip.h │ ├── zlib.h │ ├── zlib_import.h │ ├── zutil.c │ └── zutil.h └── oscii-bot ├── Makefile ├── OSCII-bot.sln ├── OSCII-bot.vcxproj ├── OSCII-bot.vcxproj.filters ├── Resources └── main.png ├── device.h ├── icon1.ico ├── license.txt ├── main.cpp ├── midi2osc.cpp ├── midi_linux.cpp ├── midi_osx.cpp ├── midi_win32.cpp ├── oscii.xcodeproj └── project.pbxproj ├── oscii ├── Base.lproj │ └── MainMenu.xib ├── OSCII-bot.icns ├── en.lproj │ ├── Credits.rtf │ └── InfoPlist.strings ├── main.m ├── oscii-Info.plist └── oscii-Prefix.pch ├── osciibot.dsp ├── osciibot.dsw ├── oscmsg.cpp ├── oscmsg.h ├── readme.txt ├── res.rc ├── resource.h └── sample_scripts ├── alphatrack.txt ├── sample_script.txt ├── show-io.txt └── sinewave_text.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | * -text 2 | *.c text=auto 3 | *.cpp text=auto 4 | *.cc text=auto 5 | *.h text=auto 6 | *.hpp text=auto 7 | *.m text=auto 8 | *.mm text=auto 9 | 10 | *.eel text=auto 11 | *.php text=auto 12 | *.txt text=auto 13 | 14 | *.bat text eol=crlf 15 | *.cmd text eol=crlf 16 | 17 | *.rc text eol=crlf 18 | *.dsp text eol=crlf 19 | *.dsw text eol=crlf 20 | *.sln text eol=crlf 21 | *.vcxproj text eol=crlf 22 | *.vcxproj.filters text eol=crlf 23 | 24 | *.sh text eol=lf 25 | *.pbxproj text eol=lf 26 | Makefile text eol=lf 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Unofficial Linux port of Cockos' [Oscii-bot](https://cockos.com/oscii-bot/) app, a scriptable OSC-to-MIDI, MIDI-to-OSC, MIDI-to-MIDI, or OSC-to-OSC converter. 3 | 4 | ## Getting Started 5 | 6 | It uses [Jack](http://www.jackaudio.org) as MIDI interface. Start the script after Jack is running + your Device is up and it should automatically build the connections you specified in the script (see [Oscii-bot documentation](https://cockos.com/oscii-bot/oscii-bot-doc.html)). 7 | 8 | By default it loads all scripts placed in `~/.config/OSCII-bot/` (start the app once to create the folder) but you can set a search directory by using the command line option `-dir /home/foo/bar/` 9 | 10 | ## Binaries 11 | You can find a binary built on Ubuntu 16.04 [here](https://github.com/veto-gh/oscii-bot/releases/). I include my libSwell.colortheme file to theme the look of the app, refer to the [Reaper Linux Forum](https://forum.cockos.com/forumdisplay.php?f=52) for more info. 12 | 13 | #### Prerequisites: 14 | * Jack1 or Jack2 15 | * if you want to use ALSA MIDI devices and have Jack2 installed: [a2jmidid](http://manual.ardour.org/setting-up-your-system/setting-up-midi/midi-on-linux/) 16 | * GTK/GDK 3.0 17 | 18 | ## Build it yourself 19 | Navigate into /oscii-bot/ and type `make` or `make GDK2=1` (for GDK2 instead of GDK3) or `make DEBUG=1` etc. 20 | 21 | #### Prerequisites: 22 | * Jack development packages (i.e. `libjack-dev` for Jack1 or `libjack-jackd2-dev` for Jack2) 23 | * gcc 24 | * make 25 | * GTK/GDK 2.0 or 3.0 development packages 26 | * php (php-cli should be sufficient) 27 | 28 | ## Where to get help 29 | 30 | * [Oscii-bot documentation](https://cockos.com/oscii-bot/oscii-bot-doc.html) 31 | * [Oscii-bot Forum](https://forum.cockos.com/forumdisplay.php?f=50) 32 | * [Reaper Linux Forum](https://forum.cockos.com/forumdisplay.php?f=52) 33 | 34 | -------------------------------------------------------------------------------- /WDL/.gitattributes: -------------------------------------------------------------------------------- 1 | * -text 2 | *.c text=auto 3 | *.cpp text=auto 4 | *.cc text=auto 5 | *.h text=auto 6 | *.hpp text=auto 7 | *.m text=auto 8 | *.mm text=auto 9 | 10 | *.eel text=auto 11 | *.php text=auto 12 | *.txt text=auto 13 | 14 | *.bat text eol=crlf 15 | *.cmd text eol=crlf 16 | 17 | *.rc text eol=crlf 18 | *.dsp text eol=crlf 19 | *.dsw text eol=crlf 20 | *.sln text eol=crlf 21 | *.vcxproj text eol=crlf 22 | *.vcxproj.filters text eol=crlf 23 | 24 | *.sh text eol=lf 25 | *.pbxproj text eol=lf 26 | Makefile text eol=lf 27 | -------------------------------------------------------------------------------- /WDL/bitfield.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDL_BITFIELD_H_ 2 | #define _WDL_BITFIELD_H_ 3 | 4 | #include "heapbuf.h" 5 | 6 | class WDL_BitField // ultra simple bit field 7 | { 8 | public: 9 | bool SetSize(int sz) // clears state 10 | { 11 | void *b=m_hb.ResizeOK((sz+7)/8); 12 | if (b) memset(b,0,m_hb.GetSize()); 13 | return !!b; 14 | } 15 | int GetApproxSize() const { return m_hb.GetSize()*8; } // may return slightly greater than the size set 16 | 17 | bool IsSet(unsigned int idx) const 18 | { 19 | const unsigned char mask = 1<<(idx&7); 20 | idx>>=3; 21 | return idx < (unsigned int)m_hb.GetSize() && (((unsigned char *)m_hb.Get())[idx]&mask); 22 | } 23 | void Set(unsigned int idx) 24 | { 25 | const unsigned char mask = 1<<(idx&7); 26 | idx>>=3; 27 | if (idx < (unsigned int)m_hb.GetSize()) ((unsigned char *)m_hb.Get())[idx] |= mask; 28 | } 29 | 30 | private: 31 | WDL_HeapBuf m_hb; 32 | }; 33 | 34 | #endif //_WDL_BITFIELD_H_ -------------------------------------------------------------------------------- /WDL/blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author : Paul Kocher 3 | * E-mail : pck@netcom.com 4 | * Date : 1997 5 | * Description: C implementation of the Blowfish algorithm. 6 | */ 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct { 13 | unsigned int P[16 + 2]; 14 | unsigned int S[4*256]; 15 | } BLOWFISH_CTX; 16 | 17 | void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen); 18 | void Blowfish_Encrypt(BLOWFISH_CTX *ctx, unsigned int *xl, unsigned int *xr); 19 | void Blowfish_Decrypt(BLOWFISH_CTX *ctx, unsigned int *xl, unsigned int *xr); 20 | 21 | #ifdef __cplusplus 22 | }; 23 | #endif -------------------------------------------------------------------------------- /WDL/chunkalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDL_CHUNKALLOC_H_ 2 | #define _WDL_CHUNKALLOC_H_ 3 | 4 | #include "wdltypes.h" 5 | 6 | class WDL_ChunkAlloc 7 | { 8 | struct _hdr 9 | { 10 | struct _hdr *_next; 11 | char data[16]; 12 | }; 13 | 14 | _hdr *m_chunks; 15 | int m_chunksize, m_chunkused; 16 | 17 | public: 18 | 19 | WDL_ChunkAlloc(int chunksize=65500) { m_chunks=NULL; m_chunkused=0; m_chunksize=chunksize>16?chunksize:16; } 20 | ~WDL_ChunkAlloc() { Free(); } 21 | 22 | void Free() 23 | { 24 | _hdr *a = m_chunks; 25 | m_chunks=0; 26 | m_chunkused=0; 27 | while (a) { _hdr *f=a; a=a->_next; free(f); } 28 | } 29 | 30 | void *Alloc(int sz, int align=0) 31 | { 32 | if (sz<1) return NULL; 33 | 34 | if (align < 1 || (align & (align-1))) align=1; 35 | 36 | if (m_chunks) 37 | { 38 | int use_sz=sz; 39 | char *p = m_chunks->data + m_chunkused; 40 | int a = ((int) (INT_PTR)p) & (align-1); 41 | if (a) 42 | { 43 | use_sz += align-a; 44 | p += align-a; 45 | } 46 | if (use_sz <= m_chunksize - m_chunkused) 47 | { 48 | m_chunkused += use_sz; 49 | return p; 50 | } 51 | } 52 | 53 | // we assume that malloc always gives at least 8 byte alignment, and our _next ptr may offset that by 4, 54 | // so no need to allocate extra if less than 4 bytes of alignment requested 55 | int use_align = (align>=4 ? align : 0); 56 | int alloc_sz=sz+use_align; 57 | if (alloc_sz < m_chunksize) 58 | { 59 | // if existing chunk has less free space in it than we would at chunksize, allocate chunksize 60 | if (!m_chunks || m_chunkused > alloc_sz) alloc_sz=m_chunksize; 61 | } 62 | _hdr *nc = (_hdr *)malloc(sizeof(_hdr) + alloc_sz - 16); 63 | if (!nc) return NULL; 64 | 65 | int use_sz=sz; 66 | char *ret = nc->data; 67 | int a = ((int) (INT_PTR)ret) & (align-1); 68 | if (a) 69 | { 70 | use_sz += align-a; 71 | ret += align-a; 72 | } 73 | 74 | if (m_chunks && (m_chunksize-m_chunkused) >= (alloc_sz - use_sz)) 75 | { 76 | // current chunk has as much or more free space than our chunk, put our chunk on the list second 77 | nc->_next = m_chunks->_next; 78 | m_chunks->_next=nc; 79 | } 80 | else 81 | { 82 | // push our chunk to the top of the list 83 | nc->_next = m_chunks; 84 | m_chunks=nc; 85 | m_chunkused = alloc_sz >= m_chunksize ? use_sz : m_chunksize; 86 | } 87 | 88 | return ret; 89 | } 90 | 91 | char *StrDup(const char *s) 92 | { 93 | if (!s) return NULL; 94 | const int l = (int) strlen(s)+1; 95 | char *ret = (char*)Alloc(l); 96 | if (!ret) return NULL; 97 | memcpy(ret,s,l); 98 | return ret; 99 | } 100 | 101 | }; 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /WDL/cmath/bessel_polynomial.h: -------------------------------------------------------------------------------- 1 | /* 2 | bessel_polynomial.h 3 | Copyright (C) 2011 and later Lubomir I. Ivanov (neolit123 [at] gmail) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | algorithm to calculate coefficients for a bessel polynomial from krall & fink 24 | series. 25 | */ 26 | 27 | #ifndef _BESSEL_POLYNOMIAL_H_ 28 | #define _BESSEL_POLYNOMIAL_H_ 29 | 30 | #include "custom_math.h" 31 | #include "factorial.h" 32 | 33 | #ifdef _BESSEL_USE_INLINE_ 34 | #define _BESSEL_INLINE _CMATH_INLINE 35 | #else 36 | #define _BESSEL_INLINE 37 | #endif 38 | 39 | #ifndef _CMATH_ANSI 40 | #define _BESSEL_MAX_ORDER 10 41 | #else 42 | #define _BESSEL_MAX_ORDER 3 43 | #endif 44 | 45 | /* return a coefficient */ 46 | _BESSEL_INLINE cmath_std_int_t 47 | bessel_coefficient(const cmath_uint16_t k, const cmath_uint16_t n) 48 | { 49 | register cmath_std_int_t c; 50 | const cmath_uint16_t nmk = (cmath_uint16_t)(n - k); 51 | c = factorial(2*n - k); 52 | c /= (factorial(nmk)*factorial(k)) * (1 << nmk); 53 | return c; 54 | } 55 | 56 | /* calculate all coefficients for n-th order polynomial */ 57 | _BESSEL_INLINE 58 | void bessel_polynomial( cmath_std_int_t *coeff, 59 | const cmath_uint16_t order, 60 | const cmath_uint16_t reverse ) 61 | { 62 | register cmath_uint16_t i = (cmath_uint16_t)(order + 1); 63 | if (reverse) 64 | { 65 | while (i--) 66 | coeff[order-i] = bessel_coefficient(i, order); 67 | } 68 | else 69 | { 70 | while (i--) 71 | coeff[i] = bessel_coefficient(i, order); 72 | } 73 | } 74 | 75 | #endif /* _BESSEL_POLYNOMIAL_H */ 76 | -------------------------------------------------------------------------------- /WDL/cmath/horner.h: -------------------------------------------------------------------------------- 1 | /* 2 | horner.h 3 | Copyright (C) 2011 and later Lubomir I. Ivanov (neolit123 [at] gmail) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | algorithm to evaluate integer order polynomials using horner's scheme. 24 | */ 25 | 26 | #ifndef _HORNER_H_ 27 | #define _HORNER_H_ 28 | 29 | #include "custom_math.h" 30 | #include "complex_number.h" 31 | 32 | /* settings */ 33 | #ifndef _HORNER_INLINE 34 | #define _HORNER_INLINE _CMATH_INLINE 35 | #else 36 | #define _HORNER_INLINE 37 | #endif 38 | 39 | /* real */ 40 | _HORNER_INLINE 41 | cmath_t horner_eval 42 | (const cmath_t *coeff, const cmath_t x, cmath_uint16_t order) 43 | { 44 | register cmath_t y = coeff[0]; 45 | register cmath_uint16_t n = 1; 46 | order += 1; 47 | while(n < order) 48 | { 49 | y = y*x + coeff[n]; 50 | n++; 51 | } 52 | return y; 53 | } 54 | 55 | /* complex */ 56 | _HORNER_INLINE 57 | cnum_s horner_eval_c 58 | (const cnum_s *coeff, const cnum_s x, cmath_uint16_t order) 59 | { 60 | register cmath_uint16_t n = 1; 61 | cnum_s y = coeff[0]; 62 | order += 1; 63 | while(n < order) 64 | { 65 | y = cnum_add(cnum_mul(y, x), coeff[n]); 66 | n++; 67 | } 68 | return y; 69 | } 70 | 71 | #endif /* _HORNER_H_ */ 72 | -------------------------------------------------------------------------------- /WDL/cmath/test_eval.c: -------------------------------------------------------------------------------- 1 | /* 2 | test_eval.h 3 | Copyright (C) 2011 and later Lubomir I. Ivanov (neolit123 [at] gmail) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /* 23 | test horner.h for complex numbers and other related headers 24 | 25 | gcc -W -Wall -Wextra -ansi pedantic 26 | cl /W4 /Za 27 | 28 | reduced precisions for ansi c 29 | */ 30 | 31 | #include "stdio.h" 32 | #include "complex_number.h" 33 | #include "horner.h" 34 | #include "durand_kerner.h" 35 | 36 | int main(void) 37 | { 38 | cmath_uint16_t i = 0; 39 | 40 | cnum_t y[] = {2, -6, 2, -1}; 41 | cnum_s cy[] = {{2, 0}, {-6, 0}, {2, 0}, {-1, 0}}; 42 | 43 | cnum_t fx = horner_eval(y, 5, poly_order(y)); 44 | cnum_s fcx = horner_eval_c(cy, _CNUM(5, 0), poly_order(y)); 45 | 46 | cnum_t dk_coeff[] = {12, -7, 0.001, 0, 3, -5}; 47 | cnum_s dk_roots[5]; 48 | 49 | cnum_s dk_coeff_c[] = {{12, 0}, {-7, 0}, {0.001, 0}, {0, 0}, {3, 0}, {-5, 0}}; 50 | cnum_s dk_roots_c[5]; 51 | 52 | durand_kerner(dk_coeff, dk_roots, poly_order(dk_coeff)); 53 | durand_kerner_c(dk_coeff_c, dk_roots_c, poly_order(dk_coeff_c)); 54 | 55 | /* */ 56 | #ifdef _CMATH_ANSI 57 | puts("\n\nansi c is: on"); 58 | #else 59 | puts("\n\nansi c is: off"); 60 | #endif 61 | 62 | /* */ 63 | puts("\n\nevaluate polynomials:\n"); 64 | printf("* y[]: %.15f\n", (double)fx); 65 | printf("* cy[]: %.15f \t %.15f*i\n", (double)fcx.r, (double)fcx.i); 66 | 67 | /* */ 68 | puts("\nfind roots:"); 69 | puts("\n* dk_coeff[]:"); 70 | i = 0; 71 | while (i < poly_order(dk_coeff)) 72 | { 73 | printf("root[%2d]: %.15f \t % .15f*i\n", 74 | i+1, (double)dk_roots[i].r, (double)dk_roots[i].i); 75 | i++; 76 | } 77 | i = 0; 78 | puts("\n* dk_coeff_c[]:"); 79 | while (i < poly_order(dk_coeff_c)) 80 | { 81 | printf("root[%2d]: %.15f \t % .15f*i\n", 82 | i+1, (double)dk_roots_c[i].r, (double)dk_roots_c[i].i); 83 | i++; 84 | } 85 | 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /WDL/db2val.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDL_DB2VAL_H_ 2 | #define _WDL_DB2VAL_H_ 3 | 4 | #include 5 | 6 | #define TWENTY_OVER_LN10 8.6858896380650365530225783783321 7 | #define LN10_OVER_TWENTY 0.11512925464970228420089957273422 8 | #define DB2VAL(x) exp((x)*LN10_OVER_TWENTY) 9 | 10 | static inline double VAL2DB(double x) 11 | { 12 | if (x < 0.0000000298023223876953125) return -150.0; 13 | double v=log(x)*TWENTY_OVER_LN10; 14 | return v<-150.0?-150.0:v; 15 | } 16 | 17 | static inline double VAL2DB_EX(double x, double mindb) 18 | { 19 | return x <= DB2VAL(mindb) ? mindb : (log(x)*TWENTY_OVER_LN10); 20 | } 21 | 22 | #endif -------------------------------------------------------------------------------- /WDL/des.h: -------------------------------------------------------------------------------- 1 | /* Loosely based on: 2 | * 3 | * D3DES (V5.09) - 4 | * 5 | * A portable, public domain, version of the Data Encryption Standard. 6 | * 7 | * Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge. 8 | * 9 | * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge. 10 | * (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992. 11 | */ 12 | 13 | 14 | #ifndef _WDL_DES_H_ 15 | #define _WDL_DES_H_ 16 | 17 | 18 | class WDL_DES 19 | { 20 | public: 21 | WDL_DES(); 22 | ~WDL_DES(); 23 | 24 | void SetKey(const unsigned char *key8, bool isEncrypt); 25 | 26 | void Process8(unsigned char *buf8); 27 | 28 | private: 29 | 30 | unsigned int m_keydata[32]; 31 | 32 | }; 33 | 34 | #endif -------------------------------------------------------------------------------- /WDL/destroycheck.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDL_DESTROYCHECK_H_ 2 | #define _WDL_DESTROYCHECK_H_ 3 | 4 | // this is a useful class for verifying that an object (usually "this") hasn't been destroyed: 5 | // to use it you add a WDL_DestroyState as a member of your class, then use the WDL_DestroyCheck 6 | // helper class (creating it when the pointer is known valid, and checking it later to see if it 7 | // is still valid). 8 | // 9 | // example: 10 | // class myClass { 11 | // WDL_DestroyState dest; 12 | // ... 13 | // }; 14 | // 15 | // calling code (on myClass *classInstnace): 16 | // WDL_DestroyCheck chk(&classInstance->dest); 17 | // somefunction(); 18 | // if (!chk.isOK()) printf("classInstance got deleted!\n"); 19 | // 20 | // NOTE: only use this when these objects will be accessed from the same thread -- it will fail miserably 21 | // in a multithreaded environment 22 | 23 | 24 | 25 | 26 | class WDL_DestroyCheck 27 | { 28 | public: 29 | class WDL_DestroyStateNextRec { public: WDL_DestroyCheck *next; }; 30 | 31 | WDL_DestroyStateNextRec n, *prev; 32 | WDL_DestroyCheck(WDL_DestroyStateNextRec *state) 33 | { 34 | n.next=NULL; 35 | if ((prev=state)) 36 | { 37 | if ((n.next=prev->next)) n.next->prev = &n; 38 | prev->next=this; 39 | } 40 | } 41 | ~WDL_DestroyCheck() 42 | { 43 | if (prev) 44 | { 45 | prev->next = n.next; 46 | if (n.next) n.next->prev = prev; 47 | } 48 | } 49 | 50 | bool isOK() { return !!prev; } 51 | }; 52 | 53 | class WDL_DestroyState : public WDL_DestroyCheck::WDL_DestroyStateNextRec 54 | { 55 | public: 56 | WDL_DestroyState() { next=NULL; } 57 | 58 | ~WDL_DestroyState() 59 | { 60 | WDL_DestroyCheck *p = next; 61 | while (p) { WDL_DestroyCheck *np = p->n.next; p->prev=NULL; p->n.next=NULL; p=np; } 62 | } 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /WDL/eel2/.gitignore: -------------------------------------------------------------------------------- 1 | /*.obj 2 | /asm-nseel-x64-macho.asm 3 | /asm-nseel-x64.asm 4 | /loose_eel.exe 5 | 6 | !/asm-nseel-x64-macho.o 7 | !/asm-nseel-x64.obj 8 | -------------------------------------------------------------------------------- /WDL/eel2/asm-nseel-x64-macho.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinfrankel/oscii-bot/8ffdbe6398315d58721b3b8efa0069a8f269f3a7/WDL/eel2/asm-nseel-x64-macho.o -------------------------------------------------------------------------------- /WDL/eel2/asm-nseel-x64.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinfrankel/oscii-bot/8ffdbe6398315d58721b3b8efa0069a8f269f3a7/WDL/eel2/asm-nseel-x64.obj -------------------------------------------------------------------------------- /WDL/eel2/eel_atomic.h: -------------------------------------------------------------------------------- 1 | #ifndef __EEL_ATOMIC_H__ 2 | #define __EEL_ATOMIC_H__ 3 | 4 | // requires these to be defined 5 | //#define EEL_ATOMIC_SET_SCOPE(opaque) WDL_Mutex *mutex = (opaque?&((effectProcessor *)opaque)->m_atomic_mutex:&atomic_mutex); 6 | //#define EEL_ATOMIC_ENTER mutex->Enter() 7 | //#define EEL_ATOMIC_LEAVE mutex->Leave() 8 | 9 | static EEL_F NSEEL_CGEN_CALL atomic_setifeq(void *opaque, EEL_F *a, EEL_F *cmp, EEL_F *nd) 10 | { 11 | EEL_F ret; 12 | EEL_ATOMIC_SET_SCOPE(opaque) 13 | EEL_ATOMIC_ENTER; 14 | ret = *a; 15 | if (fabs(ret - *cmp) < NSEEL_CLOSEFACTOR) *a = *nd; 16 | EEL_ATOMIC_LEAVE; 17 | return ret; 18 | } 19 | 20 | static EEL_F NSEEL_CGEN_CALL atomic_exch(void *opaque, EEL_F *a, EEL_F *b) 21 | { 22 | EEL_F tmp; 23 | EEL_ATOMIC_SET_SCOPE(opaque) 24 | EEL_ATOMIC_ENTER; 25 | tmp = *b; 26 | *b = *a; 27 | *a = tmp; 28 | EEL_ATOMIC_LEAVE; 29 | return tmp; 30 | } 31 | 32 | static EEL_F NSEEL_CGEN_CALL atomic_add(void *opaque, EEL_F *a, EEL_F *b) 33 | { 34 | EEL_F tmp; 35 | EEL_ATOMIC_SET_SCOPE(opaque) 36 | EEL_ATOMIC_ENTER; 37 | tmp = (*a += *b); 38 | EEL_ATOMIC_LEAVE; 39 | return tmp; 40 | } 41 | 42 | static EEL_F NSEEL_CGEN_CALL atomic_set(void *opaque, EEL_F *a, EEL_F *b) 43 | { 44 | EEL_F tmp; 45 | EEL_ATOMIC_SET_SCOPE(opaque) 46 | EEL_ATOMIC_ENTER; 47 | tmp = *a = *b; 48 | EEL_ATOMIC_LEAVE; 49 | return tmp; 50 | } 51 | 52 | static EEL_F NSEEL_CGEN_CALL atomic_get(void *opaque, EEL_F *a) 53 | { 54 | EEL_F tmp; 55 | EEL_ATOMIC_SET_SCOPE(opaque) 56 | EEL_ATOMIC_ENTER; 57 | tmp = *a; 58 | EEL_ATOMIC_LEAVE; 59 | return tmp; 60 | } 61 | 62 | static void EEL_atomic_register() 63 | { 64 | NSEEL_addfunc_retval("atomic_setifequal",3, NSEEL_PProc_THIS, &atomic_setifeq); 65 | NSEEL_addfunc_retval("atomic_exch",2, NSEEL_PProc_THIS, &atomic_exch); 66 | NSEEL_addfunc_retval("atomic_add",2, NSEEL_PProc_THIS, &atomic_add); 67 | NSEEL_addfunc_retval("atomic_set",2, NSEEL_PProc_THIS, &atomic_set); 68 | NSEEL_addfunc_retval("atomic_get",1, NSEEL_PProc_THIS, &atomic_get); 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /WDL/eel2/eel_eval.h: -------------------------------------------------------------------------------- 1 | #ifndef _EEL_EVAL_H_ 2 | #define _EEL_EVAL_H_ 3 | 4 | #ifndef EEL_EVAL_GET_CACHED 5 | #define EEL_EVAL_GET_CACHED(str, ch) (NULL) 6 | #endif 7 | 8 | #ifndef EEL_EVAL_SET_CACHED 9 | #define EEL_EVAL_SET_CACHED(sv, ch) { NSEEL_code_free(ch); free(sv); } 10 | #endif 11 | 12 | #ifndef EEL_EVAL_SCOPE_ENTER 13 | #define EEL_EVAL_SCOPE_ENTER 1 14 | #define EEL_EVAL_SCOPE_LEAVE 15 | #endif 16 | 17 | static EEL_F NSEEL_CGEN_CALL _eel_eval(void *opaque, EEL_F *s) 18 | { 19 | NSEEL_VMCTX r = EEL_EVAL_GET_VMCTX(opaque); 20 | NSEEL_CODEHANDLE ch = NULL; 21 | char *sv=NULL; 22 | if (r) 23 | { 24 | EEL_STRING_MUTEXLOCK_SCOPE 25 | const char *str=EEL_STRING_GET_FOR_INDEX(*s,NULL); 26 | #ifdef EEL_STRING_DEBUGOUT 27 | if (!str) 28 | { 29 | EEL_STRING_DEBUGOUT("eval() passed invalid string handle %f",*s); 30 | } 31 | #endif 32 | if (str && *str) 33 | { 34 | sv=EEL_EVAL_GET_CACHED(str,ch); 35 | if (!sv) sv=strdup(str); 36 | } 37 | } 38 | if (sv) 39 | { 40 | if (!ch) ch = NSEEL_code_compile(r,sv,0); 41 | if (ch) 42 | { 43 | if (EEL_EVAL_SCOPE_ENTER) 44 | { 45 | NSEEL_code_execute(ch); 46 | EEL_EVAL_SCOPE_LEAVE 47 | } 48 | else 49 | { 50 | #ifdef EEL_STRING_DEBUGOUT 51 | EEL_STRING_DEBUGOUT("eval() reentrancy limit reached"); 52 | #endif 53 | } 54 | 55 | EEL_EVAL_SET_CACHED(sv,ch); 56 | return 1.0; 57 | } 58 | else 59 | { 60 | #ifdef EEL_STRING_DEBUGOUT 61 | const char *err=NSEEL_code_getcodeerror(r); 62 | if (err) EEL_STRING_DEBUGOUT("eval() error: %s",err); 63 | #endif 64 | } 65 | free(sv); 66 | } 67 | return 0.0; 68 | } 69 | 70 | void EEL_eval_register() 71 | { 72 | NSEEL_addfunc_retval("eval",1,NSEEL_PProc_THIS,&_eel_eval); 73 | } 74 | 75 | #ifdef EEL_WANT_DOCUMENTATION 76 | static const char *eel_eval_function_reference = 77 | "eval\t\"code\"\tExecutes code passed in. Code can use functions, but functions created in code can't be used elsewhere.\0" 78 | ; 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /WDL/eel2/eel_misc.h: -------------------------------------------------------------------------------- 1 | #ifndef _EEL_MISC_H_ 2 | #define _EEL_MISC_H_ 3 | 4 | 5 | #ifndef _WIN32 6 | #include 7 | #endif 8 | #include 9 | // some generic EEL functions for things like time 10 | 11 | #ifndef EEL_MISC_NO_SLEEP 12 | static EEL_F NSEEL_CGEN_CALL _eel_sleep(void *opaque, EEL_F *amt) 13 | { 14 | if (*amt >= 0.0) 15 | { 16 | #ifdef _WIN32 17 | if (*amt > 30000000.0) Sleep(30000000); 18 | else Sleep((DWORD)(*amt+0.5)); 19 | #else 20 | if (*amt > 30000000.0) usleep(((useconds_t)30000000)*1000); 21 | else usleep((useconds_t)(*amt*1000.0+0.5)); 22 | #endif 23 | } 24 | return 0.0; 25 | } 26 | #endif 27 | 28 | static EEL_F * NSEEL_CGEN_CALL _eel_time(void *opaque, EEL_F *v) 29 | { 30 | *v = (EEL_F) time(NULL); 31 | return v; 32 | } 33 | 34 | static EEL_F * NSEEL_CGEN_CALL _eel_time_precise(void *opaque, EEL_F *v) 35 | { 36 | #ifdef _WIN32 37 | LARGE_INTEGER freq,now; 38 | QueryPerformanceFrequency(&freq); 39 | QueryPerformanceCounter(&now); 40 | *v = (double)now.QuadPart / (double)freq.QuadPart; 41 | // *v = (EEL_F)timeGetTime() * 0.001; 42 | #else 43 | struct timeval tm={0,}; 44 | gettimeofday(&tm,NULL); 45 | *v = tm.tv_sec + tm.tv_usec*0.000001; 46 | #endif 47 | return v; 48 | } 49 | 50 | 51 | void EEL_misc_register() 52 | { 53 | #ifndef EEL_MISC_NO_SLEEP 54 | NSEEL_addfunc_retval("sleep",1,NSEEL_PProc_THIS,&_eel_sleep); 55 | #endif 56 | NSEEL_addfunc_retptr("time",1,NSEEL_PProc_THIS,&_eel_time); 57 | NSEEL_addfunc_retptr("time_precise",1,NSEEL_PProc_THIS,&_eel_time_precise); 58 | } 59 | 60 | #ifdef EEL_WANT_DOCUMENTATION 61 | static const char *eel_misc_function_reference = 62 | #ifndef EEL_MISC_NO_SLEEP 63 | "sleep\tms\tYields the CPU for the millisecond count specified, calling Sleep() on Windows or usleep() on other platforms.\0" 64 | #endif 65 | "time\t[&val]\tSets the parameter (or a temporary buffer if omitted) to the number of seconds since January 1, 1970, and returns a reference to that value. " 66 | "The granularity of the value returned is 1 second.\0" 67 | "time_precise\t[&val]\tSets the parameter (or a temporary buffer if omitted) to a system-local timestamp in seconds, and returns a reference to that value. " 68 | "The granularity of the value returned is system defined (but generally significantly smaller than one second).\0" 69 | ; 70 | #endif 71 | 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /WDL/eel2/gen-lex-yacc: -------------------------------------------------------------------------------- 1 | yacc -v -d eel2.y && flex eel2.l 2 | -------------------------------------------------------------------------------- /WDL/eel2/loose_eel.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "loose_eel"=.\loose_eel.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /WDL/eel2/loose_eel.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2013 for Windows Desktop 4 | VisualStudioVersion = 12.0.30110.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loose_eel", "loose_eel.vcxproj", "{893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}.Debug|Win32.Build.0 = Debug|Win32 18 | {893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}.Debug|x64.ActiveCfg = Debug|x64 19 | {893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}.Debug|x64.Build.0 = Debug|x64 20 | {893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}.Release|Win32.ActiveCfg = Release|Win32 21 | {893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}.Release|Win32.Build.0 = Release|Win32 22 | {893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}.Release|x64.ActiveCfg = Release|x64 23 | {893B9C0E-73CA-4843-A3BC-8A3FF9055FA8}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /WDL/eel2/makefile.vc: -------------------------------------------------------------------------------- 1 | 2 | EEL_SOURCE = nseel-caltab.c nseel-cfunc.c nseel-compiler.c nseel-eval.c nseel-lextab.c nseel-ram.c nseel-yylex.c 3 | 4 | LICE_SOURCE = ../lice/lice.cpp ../lice/lice_image.cpp ../lice/lice_line.cpp ../lice/lice_ico.cpp ../lice/lice_bmp.cpp ../lice/lice_textnew.cpp ../lice/lice_text.cpp ../lice/lice_arc.cpp 5 | 6 | FFT_SOURCE = ../fft.c 7 | CFLAGS = /DWDL_FFT_REALSIZE=8 /DEEL_LICE_WANT_STANDALONE 8 | 9 | CFLAGS = $(CFLAGS) -DNSEEL_LOOPFUNC_SUPPORT_MAXLEN=0 10 | 11 | LFLAGS = 12 | 13 | !ifndef VC6 14 | CFLAGS = $(CFLAGS) /MT 15 | !else 16 | CFLAGS = $(CFLAGS) /MD 17 | LFLAGS = $(LFLAGS) /OPT:NOWIN98 18 | !endif 19 | 20 | !ifdef x64 21 | !ifndef PORTABLE 22 | EEL_SOURCE = $(EEL_SOURCE) asm-nseel-x64.obj 23 | !endif 24 | !endif 25 | 26 | 27 | default: loose_eel.exe 28 | 29 | !ifdef PORTABLE 30 | CFLAGS = $(CFLAGS) -DEEL_TARGET_PORTABLE 31 | !endif 32 | 33 | loose_eel.cpp: eel*.h ns-eel*.h 34 | 35 | $(EEL_SOURCE): ns-eel*.h 36 | 37 | 38 | loose_eel.exe: loose_eel.cpp $(EEL_SOURCE) $(FFT_SOURCE) $(LICE_SOURCE) 39 | cl $(CFLAGS) $** /link wsock32.lib user32.lib gdi32.lib advapi32.lib $(LFLAGS) /out:$@ 40 | 41 | eel_disasm.exe: eel_disasm.cpp $(EEL_SOURCE) 42 | cl $(CFLAGS) $** /link wsock32.lib user32.lib gdi32.lib advapi32.lib $(LFLAGS) /out:$@ 43 | 44 | test: eel_disasm.exe 45 | eel_disasm "buf[a] = x*y" 46 | -------------------------------------------------------------------------------- /WDL/eel2/ns-eel-addfuncs.h: -------------------------------------------------------------------------------- 1 | /* 2 | Nullsoft Expression Evaluator Library (NS-EEL) 3 | Copyright (C) 1999-2003 Nullsoft, Inc. 4 | 5 | ns-eel-addfuncs.h: defines macros useful for adding functions to the compiler 6 | 7 | This software is provided 'as-is', without any express or implied 8 | warranty. In no event will the authors be held liable for any damages 9 | arising from the use of this software. 10 | 11 | Permission is granted to anyone to use this software for any purpose, 12 | including commercial applications, and to alter it and redistribute it 13 | freely, subject to the following restrictions: 14 | 15 | 1. The origin of this software must not be misrepresented; you must not 16 | claim that you wrote the original software. If you use this software 17 | in a product, an acknowledgment in the product documentation would be 18 | appreciated but is not required. 19 | 2. Altered source versions must be plainly marked as such, and must not be 20 | misrepresented as being the original software. 21 | 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | #ifndef __NS_EEL_ADDFUNCS_H__ 25 | #define __NS_EEL_ADDFUNCS_H__ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | struct _compileContext; 32 | 33 | void *NSEEL_PProc_RAM(void *data, int data_size, struct _compileContext *ctx); 34 | void *NSEEL_PProc_THIS(void *data, int data_size, struct _compileContext *ctx); 35 | 36 | 37 | #ifdef EEL_TARGET_PORTABLE 38 | 39 | extern EEL_BC_TYPE _asm_generic3parm[]; // 3 double * parms, returning double * 40 | extern EEL_BC_TYPE _asm_generic3parm_retd[]; // 3 double * parms, returning double 41 | extern EEL_BC_TYPE _asm_generic2parm[]; // 2 double * parms, returning double * 42 | extern EEL_BC_TYPE _asm_generic2parm_retd[]; // 2 double * parms, returning double 43 | extern EEL_BC_TYPE _asm_generic1parm[]; // 1 double * parms, returning double * 44 | extern EEL_BC_TYPE _asm_generic1parm_retd[]; // 1 double * parms, returning double 45 | 46 | extern const void *const _asm_generic1parm_retd_end; 47 | extern const void *const _asm_generic1parm_end; 48 | extern const void *const _asm_generic2parm_retd_end; 49 | extern const void *const _asm_generic2parm_end; 50 | extern const void *const _asm_generic3parm_retd_end; 51 | extern const void *const _asm_generic3parm_end; 52 | #else 53 | 54 | void _asm_generic3parm(void); // 3 double * parms, returning double * 55 | void _asm_generic3parm_end(void); 56 | void _asm_generic3parm_retd(void); // 3 double * parms, returning double 57 | void _asm_generic3parm_retd_end(void); 58 | void _asm_generic2parm(void); // 2 double * parms, returning double * 59 | void _asm_generic2parm_end(void); 60 | void _asm_generic2parm_retd(void); // 2 double * parms, returning double 61 | void _asm_generic2parm_retd_end(void); 62 | void _asm_generic1parm(void); // 1 double * parms, returning double * 63 | void _asm_generic1parm_end(void); 64 | void _asm_generic1parm_retd(void); // 1 double * parms, returning double 65 | void _asm_generic1parm_retd_end(void); 66 | 67 | #endif 68 | 69 | #if EEL_F_SIZE == 4 70 | #define EEL_F_SSTR "4" 71 | #define EEL_F_SUFFIX "s" 72 | #else 73 | #define EEL_F_SSTR "8" 74 | #define EEL_F_SUFFIX "l" 75 | #endif 76 | 77 | #ifdef __cplusplus 78 | }; 79 | 80 | #endif 81 | #endif//__NS_EEL_ADDFUNCS_H__ 82 | -------------------------------------------------------------------------------- /WDL/eel2/nseel-caltab.c: -------------------------------------------------------------------------------- 1 | // no longer used -------------------------------------------------------------------------------- /WDL/eel2/nseel-lextab.c: -------------------------------------------------------------------------------- 1 | // no longer used -------------------------------------------------------------------------------- /WDL/eel2/nseel-yylex.c: -------------------------------------------------------------------------------- 1 | /* 2 | Expression Evaluator Library (NS-EEL) 3 | Copyright (C) 2004-2013 Cockos Incorporated 4 | Copyright (C) 1999-2003 Nullsoft, Inc. 5 | 6 | nseel-yylex.c 7 | 8 | This software is provided 'as-is', without any express or implied 9 | warranty. In no event will the authors be held liable for any damages 10 | arising from the use of this software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, 13 | including commercial applications, and to alter it and redistribute it 14 | freely, subject to the following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not 17 | claim that you wrote the original software. If you use this software 18 | in a product, an acknowledgment in the product documentation would be 19 | appreciated but is not required. 20 | 2. Altered source versions must be plainly marked as such, and must not be 21 | misrepresented as being the original software. 22 | 3. This notice may not be removed or altered from any source distribution. 23 | */ 24 | 25 | 26 | #include "ns-eel-int.h" 27 | 28 | 29 | 30 | # define YYMALLOC malloc 31 | # define YYFREE free 32 | 33 | int nseellex(void * yylval_param,void * yylloc_param ,void *yyscanner); 34 | void nseelerror(void *pos,compileContext *ctx, const char *str); 35 | 36 | // inhibit a warning: 37 | static void WDL_STATICFUNC_UNUSED yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, compileContext* context); 38 | 39 | #include 40 | #include 41 | 42 | #include "y.tab.c" 43 | 44 | -------------------------------------------------------------------------------- /WDL/eel2/scripts/circle.eel: -------------------------------------------------------------------------------- 1 | gfx_init("vis",1024,768); 2 | 3 | zp=-0.84; 4 | fill=0; 5 | radj=1; 6 | while ((c=gfx_getchar())!=27 && c >= 0) 7 | ( 8 | c == 'f' ? fill=!fill; 9 | c == 'j' ? jitter=!jitter; 10 | c == 'm' ? radj = !radj; 11 | 12 | gfx_r=gfx_g=gfx_b=1; 13 | gfx_a=1; 14 | gfx_x=gfx_y=0; 15 | gfx_printf("[f]ill=%s, [j]itter=%s, [m]ove=%s [%f] %d,%d",fill?"on":"off",jitter?"on":"off",radj?"on":"off",zp,mouse_x,mouse_y); 16 | gfx_a=0.25; 17 | 18 | 19 | radj ? zp+=0.03; 20 | gfx_getchar('up') ? zp+=0.03; 21 | gfx_getchar('down') ? zp-=0.03; 22 | zp2+=0.1; 23 | rd = (1+sin(zp*1.3))*(gfx_w/8-16) + 3; 24 | jitter ? ( 25 | xoffs=0.5+sin(zp2*6.7)*0.5; 26 | yoffs=0.5+sin(zp2*7.7)*0.5; 27 | rd|=0; 28 | rd += 0.5+sin(zp2*3.1)*0.5 29 | ) : ( xoffs=yoffs=0; rd|= 0;); 30 | 31 | 32 | gfx_circle(xoffs+(gfx_w/4)|0,yoffs+(gfx_h/2)|0,rd, fill,0); 33 | gfx_circle(xoffs+(gfx_w*3/4)|0,yoffs+(gfx_h/2)|0,rd, fill,1); 34 | 35 | gfx_mode=4+(1<<4); // filtering off, additive 36 | gfx_a=1; 37 | zsz=20; 38 | outsz=gfx_w/4; 39 | gfx_blit(-1,0,0, 40 | gfx_w/4-zsz, gfx_h/2-zsz, zsz*2,zsz*2, 41 | 0,gfx_h-outsz,outsz,outsz); 42 | 43 | gfx_blit(-1,0,0, 44 | gfx_w*3/4-zsz, gfx_h/2-zsz, zsz*2,zsz*2, 45 | gfx_w-outsz,gfx_h-outsz,outsz,outsz); 46 | gfx_mode=0; 47 | 48 | gfx_update(); 49 | sleep(30); 50 | ); 51 | -------------------------------------------------------------------------------- /WDL/eel2/scripts/eval_test.eel: -------------------------------------------------------------------------------- 1 | argc < 2 ? ( 2 | printf("Usage: %s [script]\n",argv[0]); 3 | 4 | ) : ( 5 | printf("loading '%s'\n",argv[1]); 6 | x = fopen(argv[1],"r"); 7 | !x ? ( 8 | printf("Error opening '%s'\n",argv[1]) 9 | ) : ( 10 | #str=""; 11 | while (fgets(x,#line)) ( #str += #line; ); 12 | fclose(x); 13 | loop(30, 14 | start_t = time_precise(); 15 | eval(#str) || printf("error evaluating script\n"); 16 | start_t = time_precise()-start_t; 17 | printf("finished in %f milliseconds\n",start_t*1000.0); 18 | ); 19 | ); 20 | ); 21 | -------------------------------------------------------------------------------- /WDL/eel2/scripts/gfx_test.eel: -------------------------------------------------------------------------------- 1 | gfx_init("vis",1024,768); 2 | 3 | gfx_clear=-1; 4 | while ((c=gfx_getchar())!=27 && c >= 0) 5 | ( 6 | c == ' ' ? (mode += 1) >= 2 ? mode=0; 7 | t=time_precise(); 8 | zsc = 0.01*cos(t*0.73); 9 | // gfx_x=gfx_y=0; gfx_blurto(gfx_w,gfx_h); 10 | gfx_blit(-1,0,0.3*(sin(t*0.3)^2),gfx_w*zsc,gfx_h*zsc, gfx_w*(1-2*zsc),gfx_h*(1-2*zsc), 0,0,gfx_w,gfx_h); 11 | gfx_r=(cos(t)+1.0)*0.5; 12 | gfx_g=(cos(t*1.74)+1.0)*0.5; 13 | gfx_b=(cos(t*1.2+0.56)+1.0)*0.5; 14 | gfx_a=0.15; 15 | sz=gfx_w*0.03; 16 | loop(20, 17 | mode == 1 ? 18 | gfx_circle(rand(gfx_w-sz),rand(gfx_h-sz),sz,1) : 19 | gfx_rect(rand(gfx_w-sz),rand(gfx_h-sz),sz,sz); 20 | ); 21 | 22 | 23 | gfx_update(); 24 | ); 25 | -------------------------------------------------------------------------------- /WDL/eel2/scripts/gfx_test_defer.eel: -------------------------------------------------------------------------------- 1 | gfx_init("vis",1024,768); 2 | 3 | gfx_clear=-1; 4 | 5 | function frame() 6 | ( 7 | c=gfx_getchar(); 8 | c == ' ' ? (mode += 1) >= 2 ? mode=0; 9 | t=time_precise(); 10 | zsc = 0.01*cos(t*0.73); 11 | // gfx_x=gfx_y=0; gfx_blurto(gfx_w,gfx_h); 12 | gfx_blit(-1,0,0.3*(sin(t*0.3)^2),gfx_w*zsc,gfx_h*zsc, gfx_w*(1-2*zsc),gfx_h*(1-2*zsc), 0,0,gfx_w,gfx_h); 13 | gfx_r=(cos(t)+1.0)*0.5; 14 | gfx_g=(cos(t*1.74)+1.0)*0.5; 15 | gfx_b=(cos(t*1.2+0.56)+1.0)*0.5; 16 | gfx_a=0.15; 17 | sz=gfx_w*0.03; 18 | loop(20, 19 | mode == 1 ? 20 | gfx_circle(rand(gfx_w-sz),rand(gfx_h-sz),sz,1) : 21 | gfx_rect(rand(gfx_w-sz),rand(gfx_h-sz),sz,sz); 22 | ); 23 | 24 | 25 | gfx_update(); 26 | c>=0 && c != 27 ? defer("frame()"); 27 | ); 28 | 29 | frame(); 30 | -------------------------------------------------------------------------------- /WDL/eel2/scripts/sinewave_text.eel: -------------------------------------------------------------------------------- 1 | width = 80; 2 | lx=-1; 3 | loop(1000000, 4 | x = ((1+sin(pos))*0.5 * width)|0; 5 | lx >= -1 && lx!=x ? ( 6 | loop(min(x,lx), printf(" ")); 7 | loop(abs(x-lx), printf("*")); 8 | loop(width-max(x,lx), printf(" ")); 9 | ) : ( 10 | loop(x, printf(" ")); 11 | printf("*"); 12 | loop(width-1-x, printf(" ")); 13 | ); 14 | lx=x; 15 | printf("\n"); 16 | pos += 0.25 + sin(pos*0.32)*0.2; 17 | ); 18 | -------------------------------------------------------------------------------- /WDL/eel2/scripts/space.eel: -------------------------------------------------------------------------------- 1 | 2 | 3 | gfx_init("space",640,480); 4 | 5 | function enemylist.init(buf, rows, cols, maxwid) global() 6 | ( 7 | this.buf = buf; 8 | this.rows=rows; 9 | this.cols=cols; 10 | this.maxwid = maxwid; 11 | loop(rows*cols, buf[]=1; buf += 1; ); 12 | ); 13 | 14 | 15 | function enemylist.draw(pos, vpos, destextent*) 16 | local(rad,buf,xpos,ypos,dxpos) 17 | global(gfx_w,gfx_h,gfx_r,gfx_g,gfx_b,gfx_a) 18 | ( 19 | gfx_r=gfx_a=1; 20 | gfx_g=gfx_b=0; 21 | dxpos = this.maxwid/this.cols*gfx_w; 22 | buf=this.buf; 23 | rad = dxpos*0.3; 24 | destextent.right = 0; 25 | destextent.bottom = 0; 26 | destextent.left=2^20; 27 | destextent.top=2^20; 28 | 29 | ypos=dxpos*0.5 + gfx_h*vpos; 30 | loop(this.rows, 31 | xpos=pos*gfx_w + dxpos*0.5; 32 | loop(this.cols, 33 | buf[] ? ( 34 | destextent.left = min(destextent.left,xpos-rad); 35 | destextent.right = max(destextent.right,xpos+rad); 36 | destextent.top = min(destextent.top,ypos-rad); 37 | destextent.bottom = max(destextent.bottom,ypos+rad); 38 | gfx_circle(xpos,ypos,rad); 39 | ); 40 | xpos += dxpos; 41 | buf += 1; 42 | ); 43 | ypos += dxpos; 44 | ); 45 | ); 46 | 47 | 48 | enemylist.init(0, 4, 8, 0.8); 49 | 50 | 51 | last_time = time_precise(); 52 | enemy_pos = 0; 53 | enemy_vpos = 0; 54 | enemy_vel = 0.05; 55 | while ((curchar = gfx_getchar()) != 27) 56 | ( 57 | now = time_precise(); 58 | enemylist.draw(enemy_pos, enemy_vpos, area); 59 | enemy_vel > 0 ? ( 60 | area.right >= gfx_w ? ( enemy_vel = -enemy_vel; enemy_vpos += abs(enemy_vel); enemy_vel *= 1.3; ); 61 | ) : ( 62 | area.left <= 0 ? ( enemy_vel = -enemy_vel; enemy_vpos += abs(enemy_vel); enemy_vel *= 1.3; ); 63 | ); 64 | 65 | enemy_pos += (now-last_time)*enemy_vel; 66 | 67 | 68 | 69 | 70 | last_time = now; 71 | sleep(33); 72 | gfx_update(); 73 | ); 74 | -------------------------------------------------------------------------------- /WDL/fft.h: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - fft.h 3 | Copyright (C) 2006 and later Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | 22 | 23 | This file defines the interface to the WDL FFT library. These routines are based on the 24 | DJBFFT library, which are Copyright 1999 D. J. Bernstein, djb@pobox.com 25 | 26 | The DJB FFT web page is: http://cr.yp.to/djbfft.html 27 | 28 | */ 29 | 30 | #ifndef _WDL_FFT_H_ 31 | #define _WDL_FFT_H_ 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | #ifndef WDL_FFT_REALSIZE 38 | #define WDL_FFT_REALSIZE 4 39 | #endif 40 | 41 | #if WDL_FFT_REALSIZE == 4 42 | typedef float WDL_FFT_REAL; 43 | #elif WDL_FFT_REALSIZE == 8 44 | typedef double WDL_FFT_REAL; 45 | #else 46 | #error invalid FFT item size 47 | #endif 48 | 49 | typedef struct { 50 | WDL_FFT_REAL re; 51 | WDL_FFT_REAL im; 52 | } WDL_FFT_COMPLEX; 53 | 54 | extern void WDL_fft_init(); 55 | 56 | extern void WDL_fft_complexmul(WDL_FFT_COMPLEX *dest, WDL_FFT_COMPLEX *src, int len); 57 | extern void WDL_fft_complexmul2(WDL_FFT_COMPLEX *dest, WDL_FFT_COMPLEX *src, WDL_FFT_COMPLEX *src2, int len); 58 | extern void WDL_fft_complexmul3(WDL_FFT_COMPLEX *destAdd, WDL_FFT_COMPLEX *src, WDL_FFT_COMPLEX *src2, int len); 59 | 60 | /* Expects WDL_FFT_COMPLEX input[0..len-1] scaled by 1.0/len, returns 61 | WDL_FFT_COMPLEX output[0..len-1] order by WDL_fft_permute(len). */ 62 | extern void WDL_fft(WDL_FFT_COMPLEX *, int len, int isInverse); 63 | 64 | /* Expects WDL_FFT_REAL input[0..len-1] scaled by 0.5/len, returns 65 | WDL_FFT_COMPLEX output[0..len/2-1], for len >= 4 order by 66 | WDL_fft_permute(len/2). Note that output[len/2].re is stored in 67 | output[0].im. */ 68 | extern void WDL_real_fft(WDL_FFT_REAL *, int len, int isInverse); 69 | 70 | extern int WDL_fft_permute(int fftsize, int idx); 71 | extern int *WDL_fft_permute_tab(int fftsize); 72 | 73 | #ifdef __cplusplus 74 | }; 75 | #endif 76 | 77 | #endif -------------------------------------------------------------------------------- /WDL/filename.h: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - filename.h 3 | Copyright (C) 2005 and later, Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | */ 22 | 23 | #ifndef _WDL_FILENAME_H_ 24 | #define _WDL_FILENAME_H_ 25 | 26 | #include 27 | #include 28 | 29 | 30 | static char WDL_filename_filterchar(char p, char repl='_', bool filterSlashes=true) 31 | { 32 | if (p == '?' || 33 | p == '*' || 34 | p == ':' || 35 | p == '\"' || 36 | p == '|' || 37 | p == '<' || 38 | p == '>') 39 | { 40 | return repl; 41 | } 42 | 43 | if (filterSlashes && (p == '/' || p == '\\' )) 44 | { 45 | return repl; 46 | } 47 | 48 | return p; 49 | } 50 | 51 | 52 | static void WDL_filename_filterstr(char *buf, char repl='_', bool filterSlashes=true) 53 | { 54 | char *rd = buf; 55 | while (*rd) 56 | { 57 | char r=WDL_filename_filterchar(*rd++,repl,filterSlashes); 58 | if (r) *buf++ = r; 59 | } 60 | *buf=0; 61 | } 62 | 63 | 64 | 65 | #endif // _WDL_FILENAME_H_ -------------------------------------------------------------------------------- /WDL/fnv64.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDL_FNV64_H_ 2 | #define _WDL_FNV64_H_ 3 | 4 | #include "wdltypes.h" 5 | 6 | #define WDL_FNV64_IV WDL_UINT64_CONST(0xCBF29CE484222325) 7 | 8 | static WDL_UINT64 WDL_FNV64(WDL_UINT64 h, const unsigned char* data, int sz) 9 | { 10 | int i; 11 | for (i=0; i < sz; ++i) 12 | { 13 | h *= WDL_UINT64_CONST(0x00000100000001B3); 14 | h ^= data[i]; 15 | } 16 | return h; 17 | } 18 | #endif -------------------------------------------------------------------------------- /WDL/giflib/AUTHORS: -------------------------------------------------------------------------------- 1 | Lennie Araki 2 | Windows code providing a nicer interface and example program 3 | 4 | Michael Brown 5 | callbacks to write data via user defined function 6 | 7 | Daniel Eisenbud 8 | Fixes for crashes with invalid gif files and double freeing of 9 | colormaps 10 | 11 | Gershon Elber 12 | original giflib code 13 | 14 | Marc Ewing 15 | spec file (for rpms) updates 16 | 17 | Toshio Kuratomi 18 | uncompressed gif writing code 19 | autoconf/automake process 20 | current maintainer 21 | 22 | marek 23 | Gif initialization fix 24 | windows build code 25 | 26 | Peter Mehlitz 27 | callbacks to read data from arbitrary sources (like libjpeg/libpng) 28 | 29 | Dick Porter 30 | int/pointer fixes for Alpha 31 | 32 | Eric Raymond 33 | long time maintainer of giflib code 34 | 35 | Georg Schwarz 36 | IRIX fixes 37 | -------------------------------------------------------------------------------- /WDL/giflib/COPYING: -------------------------------------------------------------------------------- 1 | The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /WDL/giflib/DEVELOPERS: -------------------------------------------------------------------------------- 1 | Things to tell developers of libungif.... 2 | 3 | ======= 4 | Build Tools: 5 | libungif presently uses autoconf, automake, and libtool in order to build 6 | shared libraries for a wide variety of platforms. The distributed tarball has 7 | files prebuilt from these tools. The cvs repository does not. If you want to 8 | build libungif you will need to have these tools available. I currently run 9 | with the following versions: 10 | autoconf 2.57 11 | automake 1.7.8 12 | libtool 1.5 13 | 14 | (P.S. I use the autogen.sh script in the top level directory to generate 15 | configure, Makefile.in, etc using these tools.) 16 | 17 | ======= 18 | cvs: 19 | I currently do my work in a subversion repository. Since sourceforge is still 20 | using cvs and not subversion, there's nothing in the sourceforge tree. 21 | 22 | If someone else wants to do development we can definitely talk about the best 23 | way to share version control access. 24 | 25 | ======= 26 | I create the distribution tar ball by using the `make dist` command.... After 27 | hacking all I want, I check my sources into cvs, checkout a clean tree, run 28 | ./autogen.sh; make dist and then attempt to compile from the libungif-*.tar.gz 29 | file that is generated. 30 | -------------------------------------------------------------------------------- /WDL/giflib/README: -------------------------------------------------------------------------------- 1 | This is giflib version 4.1.2, a library for manipulating gif files. It is based 2 | on Eric S. Raymond's giflib-3.0 with bugfixes and changes generated for the 3 | libungif library. 4 | 5 | PLEASE BE AWARE OF POSSIBLE LEGAL PROBLEMS WITH USING THIS LIBRARY: READ 6 | THE PATENT_PROBLEMS FILE NOW! 7 | 8 | ======= 9 | Latest versions of giflib, as well as a library which does not have the 10 | mentioned patent problems (libungif), are available from: 11 | http://sourceforge.net/projects/libungif 12 | 13 | ==== 14 | Building this package should be as simple as: 15 | 16 | ./configure 17 | gmake 18 | gmake install 19 | 20 | ==== 21 | Deprecation list. Will be removed in giflib 5.0: 22 | * GIF_ERROR and GIF_MESSAGE are on the deprecation list as they are also 23 | utility helper functions rather than essential to the functioning of the 24 | library. 25 | * The qprintf methods of the library are now deprecated. Do not use 26 | GifQuietPrint or GifQprintf. These should have been pushed out into the 27 | utility helper library instead of sitting around in the library proper at 28 | the same time as the getarg functions were moved out. Getting rid of these 29 | will let us get rid of our dependence on stdarg.h/varargs.h (Which a Gif 30 | reading library has no business requiring.) 31 | * In the SavedImage struct: int Function will be removed. Use 32 | SavedImage.ExtensionBlocks[x].Function instead. 33 | * In gifalloc.c: MakeExtension is deprecated as well. Use AddExtensionBlock 34 | instead. (This and the previous int Function were deprecated because they 35 | only handle one Extension per image. The new code handles multiple 36 | extensions.) 37 | * varargs style interface in qprintf and getarg: It's a mistake to have two 38 | different interfaces that depend on compile time choices between varargs 39 | and stdargs. The future is to get rid of varargs style altogether. 40 | (Also: these are probably going strictly into the utility functions so 41 | the library won't have to worry about them at all.) 42 | ==== 43 | 44 | I have found that automake currently generates Makefile's containing some 45 | GNUmake specific syntax. If you're having troubles building with your 46 | system provided make, please install GNU make and try rebuilding. 47 | 48 | ==== 49 | This package uses autoconf, automake, and libtool to create the configure 50 | script, so if you need to edit the configure.ac or change a makefile target 51 | you should read the DEVELOPER file for hints on recreating the distribution 52 | using these tools. 53 | 54 | Good luck! 55 | -Toshio Kuratomi 56 | 57 | ==== READ.ME file for giflib version 3.0: 58 | 59 | READ ME for GIFLIB 60 | 61 | For complete documentation on the package, point a web browser at 62 | doc/index.html. See the file INSTALL for instructions on how to 63 | install and test the package. 64 | 65 | GIFLIB has a home page at http://www.ccil.org/~esr/giflib. 66 | 67 | Eric S. Raymond 68 | esr@snark.thyrsus.com. 69 | (http://www.ccil.org/~esr) 70 | -------------------------------------------------------------------------------- /WDL/giflib/config.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONFIG_H_ 2 | #define _CONFIG_H_ 3 | #ifdef _WIN32 4 | #include 5 | #include 6 | #define _OPEN_BINARY 7 | #else 8 | typedef unsigned int UINT32; 9 | #include 10 | #include 11 | #include 12 | #endif 13 | #include 14 | #endif 15 | -------------------------------------------------------------------------------- /WDL/giflib/gif_hash.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Declarations, global to other of the GIF-HASH.C module. * 3 | * * 4 | * Written by Gershon Elber, Jun 1989 * 5 | ******************************************************************************* 6 | * History: * 7 | * 14 Jun 89 - Version 1.0 by Gershon Elber. * 8 | ******************************************************************************/ 9 | 10 | #ifndef _GIF_HASH_H_ 11 | #define _GIF_HASH_H_ 12 | 13 | #include "config.h" 14 | 15 | /* Find a thirty-two bit int type */ 16 | #ifdef HAVE_SYS_TYPES_H 17 | #include 18 | #endif 19 | #ifdef HAVE_STDINT_H 20 | #include 21 | #endif 22 | #ifdef HAVE_BASETSD_H 23 | #include 24 | #endif 25 | 26 | #define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */ 27 | #define HT_KEY_MASK 0x1FFF /* 13bits keys */ 28 | #define HT_KEY_NUM_BITS 13 /* 13bits keys */ 29 | #define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */ 30 | #define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ 31 | 32 | /* The 32 bits of the long are divided into two parts for the key & code: */ 33 | /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */ 34 | /* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */ 35 | /* The key is the upper 20 bits. The code is the lower 12. */ 36 | #define HT_GET_KEY(l) (l >> 12) 37 | #define HT_GET_CODE(l) (l & 0x0FFF) 38 | #define HT_PUT_KEY(l) (l << 12) 39 | #define HT_PUT_CODE(l) (l & 0x0FFF) 40 | 41 | typedef struct GifHashTableType { 42 | UINT32 HTable[HT_SIZE]; 43 | } GifHashTableType; 44 | 45 | GifHashTableType *_InitHashTable(void); 46 | void _ClearHashTable(GifHashTableType *HashTable); 47 | void _InsertHashTable(GifHashTableType *HashTable, UINT32 Key, int Code); 48 | int _ExistsHashTable(GifHashTableType *HashTable, UINT32 Key); 49 | 50 | #endif /* _GIF_HASH_H_ */ 51 | -------------------------------------------------------------------------------- /WDL/giflib/gif_lib_private.h: -------------------------------------------------------------------------------- 1 | #ifndef _GIF_LIB_PRIVATE_H 2 | #define _GIF_LIB_PRIVATE_H 3 | 4 | #include "gif_lib.h" 5 | #include "gif_hash.h" 6 | 7 | #define PROGRAM_NAME "GIFLIB" 8 | 9 | #ifdef SYSV 10 | #define VersionStr "Gif library module,\t\tEric S. Raymond\n\ 11 | (C) Copyright 1997 Eric S. Raymond\n" 12 | #else 13 | #define VersionStr PROGRAM_NAME " IBMPC " GIF_LIB_VERSION \ 14 | " Eric S. Raymond, " __DATE__ ", " \ 15 | __TIME__ "\n" "(C) Copyright 1997 Eric S. Raymond\n" 16 | #endif /* SYSV */ 17 | 18 | #define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ 19 | #define LZ_BITS 12 20 | 21 | #define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */ 22 | #define FIRST_CODE 4097 /* Impossible code, to signal first. */ 23 | #define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */ 24 | 25 | #define FILE_STATE_WRITE 0x01 26 | #define FILE_STATE_SCREEN 0x02 27 | #define FILE_STATE_IMAGE 0x04 28 | #define FILE_STATE_READ 0x08 29 | 30 | #define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ) 31 | #define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE) 32 | 33 | typedef struct GifFilePrivateType { 34 | GifWord FileState, FileHandle, /* Where all this data goes to! */ 35 | BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */ 36 | ClearCode, /* The CLEAR LZ code. */ 37 | EOFCode, /* The EOF LZ code. */ 38 | RunningCode, /* The next code algorithm can generate. */ 39 | RunningBits, /* The number of bits required to represent RunningCode. */ 40 | MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ 41 | LastCode, /* The code before the current code. */ 42 | CrntCode, /* Current algorithm code. */ 43 | StackPtr, /* For character stack (see below). */ 44 | CrntShiftState; /* Number of bits in CrntShiftDWord. */ 45 | unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */ 46 | unsigned long PixelCount; /* Number of pixels in image. */ 47 | FILE *File; /* File as stream. */ 48 | InputFunc Read; /* function to read gif input (TVT) */ 49 | OutputFunc Write; /* function to write gif output (MRB) */ 50 | GifByteType Buf[256]; /* Compressed input is buffered here. */ 51 | GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */ 52 | GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */ 53 | GifPrefixType Prefix[LZ_MAX_CODE + 1]; 54 | GifHashTableType *HashTable; 55 | } GifFilePrivateType; 56 | 57 | extern int _GifError; 58 | 59 | #endif /* _GIF_LIB_PRIVATE_H */ 60 | -------------------------------------------------------------------------------- /WDL/jnetlib/Makefile: -------------------------------------------------------------------------------- 1 | # freebsd3 makefile 2 | default: jnl.a 3 | 4 | LDFLAGS = -pthread 5 | CFLAGS = -s -O2 -Wall -DTHREAD_SAFE -D_THREAD_SAFE -D_REENTRANT 6 | CC = gcc 7 | CPP = g++ 8 | CXX = g++ 9 | 10 | OBJS = asyncdns.o connection.o httpget.o httpserv.o listen.o util.o sercon.o 11 | 12 | jnl.a: ${OBJS} 13 | -rm -f jnl.a 14 | ar rcs jnl.a ${OBJS} 15 | 16 | test: ${OBJS} test.o 17 | $(CC) ${CFLAGS} -o test test.o ${OBJS} ${LDFLAGS} 18 | 19 | clean: 20 | -rm -f ${OBJS} test jnl.a test.o 21 | -------------------------------------------------------------------------------- /WDL/jnetlib/asyncdns.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** JNetLib 3 | ** Copyright (C) 2008 Cockos Inc 4 | ** Copyright (C) 2000-2001 Nullsoft, Inc. 5 | ** Author: Justin Frankel 6 | ** File: asyncdns.h - JNL portable asynchronous DNS interface 7 | ** License: see jnetlib.h 8 | ** 9 | ** Usage: 10 | ** 1. Create JNL_AsyncDNS object, optionally with the number of cache entries. 11 | ** 2. call resolve() to resolve a hostname into an address. The return value of 12 | ** resolve is 0 on success (host successfully resolved), 1 on wait (meaning 13 | ** try calling resolve() with the same hostname in a few hundred milliseconds 14 | ** or so), or -1 on error (i.e. the host can't resolve). 15 | ** 3. call reverse() to do reverse dns (ala resolve()). 16 | ** 4. enjoy. 17 | */ 18 | 19 | #ifndef _ASYNCDNS_H_ 20 | #define _ASYNCDNS_H_ 21 | 22 | #include 23 | 24 | #ifndef JNL_NO_DEFINE_INTERFACES 25 | class JNL_IAsyncDNS 26 | { 27 | public: 28 | virtual ~JNL_IAsyncDNS() { } 29 | virtual int resolve(const char *hostname, unsigned int *addr)=0; // return 0 on success, 1 on wait, -1 on unresolvable 30 | virtual int reverse(unsigned int addr, char *hostname)=0; // return 0 on success, 1 on wait, -1 on unresolvable. hostname must be at least 256 bytes. 31 | }; 32 | #define JNL_AsyncDNS_PARENTDEF : public JNL_IAsyncDNS 33 | #else 34 | #define JNL_IAsyncDNS JNL_AsyncDNS 35 | #define JNL_AsyncDNS_PARENTDEF 36 | #endif 37 | 38 | 39 | #ifndef JNL_NO_IMPLEMENTATION 40 | 41 | class JNL_AsyncDNS JNL_AsyncDNS_PARENTDEF 42 | { 43 | public: 44 | JNL_AsyncDNS(int max_cache_entries=64); 45 | ~JNL_AsyncDNS(); 46 | 47 | int resolve(const char *hostname, unsigned int *addr); // return 0 on success, 1 on wait, -1 on unresolvable 48 | int reverse(unsigned int addr, char *hostname); // return 0 on success, 1 on wait, -1 on unresolvable. hostname must be at least 256 bytes. 49 | 50 | private: 51 | typedef struct 52 | { 53 | time_t last_used; // timestamp. 54 | char resolved; 55 | char mode; // 1=reverse 56 | char hostname[256]; 57 | unsigned int addr; 58 | } 59 | cache_entry; 60 | 61 | cache_entry *m_cache; 62 | int m_cache_size; 63 | volatile int m_thread_kill; 64 | #ifdef _WIN32 65 | HANDLE m_thread; 66 | static unsigned WINAPI _threadfunc(void *_d); 67 | #else 68 | pthread_t m_thread; 69 | static unsigned int _threadfunc(void *_d); 70 | #endif 71 | void makesurethreadisrunning(void); 72 | 73 | }; 74 | #endif // !JNL_NO_IMPLEMENTATION 75 | 76 | #endif //_ASYNCDNS_H_ 77 | -------------------------------------------------------------------------------- /WDL/jnetlib/irc_util.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDL_JNL_IRC_UTIL_H_ 2 | #define _WDL_JNL_IRC_UTIL_H_ 3 | 4 | #include "netinc.h" 5 | 6 | static void FormatIRCMessage(char *bufout, const char *fmt, ...) // bufout should be 1024 bytes to be safe 7 | { 8 | va_list arglist; 9 | va_start(arglist, fmt); 10 | #ifdef _WIN32 11 | int written = _vsnprintf(bufout, 1024-16, fmt, arglist); 12 | #else 13 | int written = vsnprintf(bufout, 1024-16, fmt, arglist); 14 | #endif 15 | if (written < 0) written = 0; 16 | else if (written > 510) written=510; 17 | bufout[written]=0; 18 | va_end(arglist); 19 | 20 | strcat(bufout,"\r\n"); 21 | } 22 | 23 | 24 | static void ParseIRCMessage(char *buf, char **prefix, char *tokens[16], int *tokensvalid, bool *lastHadColon) // destroys buf 25 | { 26 | if (lastHadColon) *lastHadColon=false; 27 | *tokensvalid=0; 28 | if (prefix) *prefix=NULL; 29 | if (*buf==':') 30 | { 31 | if (prefix) *prefix=buf; 32 | while (*buf && *buf != ' ') buf++; 33 | if (*buf==' ') 34 | { 35 | *buf++=0; 36 | while (*buf== ' ') buf++; 37 | } 38 | } 39 | 40 | while (*buf && *tokensvalid < 16) 41 | { 42 | tokens[(*tokensvalid)++] = buf[0] == ':' ? buf+1 : buf; 43 | if (buf[0] == ':' || *tokensvalid == 16) 44 | { 45 | if (buf[0] == ':' && lastHadColon) *lastHadColon=true; 46 | break; 47 | } 48 | 49 | // skip over parameter 50 | while (*buf && *buf != ' ') buf++; 51 | if (*buf == ' ') 52 | { 53 | *buf++=0; 54 | while (*buf== ' ') buf++; 55 | } 56 | 57 | } 58 | } 59 | #endif -------------------------------------------------------------------------------- /WDL/jnetlib/jnetlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** JNetLib 3 | ** Copyright (C) 2008 Cockos Inc 4 | ** Copyright (C) 2000-2003 Nullsoft, Inc. 5 | ** Author: Justin Frankel 6 | ** File: jnetlib.h - JNL main include file (not really necessary). 7 | ** 8 | ** For documentation, look at the following files: 9 | ** Generic network initialization: netinc.h 10 | ** DNS: asyncdns.h 11 | ** TCP connections: connection.h 12 | ** HTTP GET connections: httpget.h 13 | ** TCP listen: listen.h 14 | ** 15 | ** license: 16 | ** 17 | ** This software is provided 'as-is', without any express or implied 18 | ** warranty. In no event will the authors be held liable for any damages 19 | ** arising from the use of this software. 20 | ** 21 | ** Permission is granted to anyone to use this software for any purpose, 22 | ** including commercial applications, and to alter it and redistribute it 23 | ** freely, subject to the following restrictions: 24 | ** 25 | ** 1. The origin of this software must not be misrepresented; you must not 26 | ** claim that you wrote the original software. If you use this software 27 | ** in a product, an acknowledgment in the product documentation would be 28 | ** appreciated but is not required. 29 | ** 2. Altered source versions must be plainly marked as such, and must not be 30 | ** misrepresented as being the original software. 31 | ** 3. This notice may not be removed or altered from any source distribution. 32 | ** 33 | */ 34 | 35 | #ifndef _JNETLIB_H_ 36 | #define _JNETLIB_H_ 37 | 38 | #include "netinc.h" 39 | #include "util.h" 40 | 41 | #include "asyncdns.h" 42 | #include "connection.h" 43 | #include "httpget.h" 44 | #include "httpserv.h" 45 | #include "listen.h" 46 | 47 | #endif//_JNETLIB_H_ 48 | -------------------------------------------------------------------------------- /WDL/jnetlib/listen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ** JNetLib 3 | ** Copyright (C) 2008 Cockos Inc 4 | ** Copyright (C) 2000-2001 Nullsoft, Inc. 5 | ** Author: Justin Frankel 6 | ** File: listen.cpp - JNL TCP listen implementation 7 | ** License: see jnetlib.h 8 | */ 9 | 10 | #include "netinc.h" 11 | #include "util.h" 12 | #include "listen.h" 13 | 14 | JNL_Listen::JNL_Listen(short port, unsigned int which_interface) 15 | { 16 | m_port=port; 17 | m_socket = ::socket(AF_INET,SOCK_STREAM,0); 18 | if (m_socket == INVALID_SOCKET) 19 | { 20 | } 21 | else 22 | { 23 | struct sockaddr_in sin; 24 | SET_SOCK_DEFAULTS(m_socket); 25 | SET_SOCK_BLOCK(m_socket,0); 26 | int bflag = 1; 27 | setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (char*)&bflag, sizeof(bflag)); 28 | memset((char *) &sin, 0,sizeof(sin)); 29 | sin.sin_family = AF_INET; 30 | sin.sin_port = htons( (short) port ); 31 | sin.sin_addr.s_addr = which_interface?which_interface:INADDR_ANY; 32 | if (::bind(m_socket,(struct sockaddr *)&sin,sizeof(sin))) 33 | { 34 | shutdown(m_socket, SHUT_RDWR); 35 | closesocket(m_socket); 36 | m_socket=INVALID_SOCKET; 37 | } 38 | else 39 | { 40 | if (::listen(m_socket,8)==-1) 41 | { 42 | shutdown(m_socket, SHUT_RDWR); 43 | closesocket(m_socket); 44 | m_socket=INVALID_SOCKET; 45 | } 46 | } 47 | } 48 | } 49 | 50 | JNL_Listen::~JNL_Listen() 51 | { 52 | if (m_socket!=INVALID_SOCKET) 53 | { 54 | shutdown(m_socket, SHUT_RDWR); 55 | closesocket(m_socket); 56 | } 57 | } 58 | 59 | JNL_IConnection *JNL_Listen::get_connect(int sendbufsize, int recvbufsize) 60 | { 61 | if (m_socket == INVALID_SOCKET) 62 | { 63 | return NULL; 64 | } 65 | struct sockaddr_in saddr; 66 | socklen_t length = sizeof(struct sockaddr_in); 67 | SOCKET s = accept(m_socket, (struct sockaddr *) &saddr, &length); 68 | if (s != INVALID_SOCKET) 69 | { 70 | JNL_IConnection *c=new JNL_Connection(NULL,sendbufsize, recvbufsize); 71 | c->connect(s,&saddr); 72 | return c; 73 | } 74 | return NULL; 75 | } 76 | -------------------------------------------------------------------------------- /WDL/jnetlib/listen.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** JNetLib 3 | ** Copyright (C) 2008 Cockos Inc 4 | ** Copyright (C) 2000-2001 Nullsoft, Inc. 5 | ** Author: Justin Frankel 6 | ** File: listen.h - JNL interface for opening a TCP listen 7 | ** License: see jnetlib.h 8 | ** 9 | ** Usage: 10 | ** 1. create a JNL_Listen object with the port and (optionally) the interface 11 | ** to listen on. 12 | ** 2. call get_connect() to get any new connections (optionally specifying what 13 | ** buffer sizes the connection should be created with) 14 | ** 3. check is_error() to see if an error has occured 15 | ** 4. call port() if you forget what port the listener is on. 16 | ** 17 | */ 18 | 19 | #ifndef _LISTEN_H_ 20 | #define _LISTEN_H_ 21 | #include "connection.h" 22 | 23 | #ifndef JNL_NO_DEFINE_INTERFACES 24 | 25 | class JNL_IListen 26 | { 27 | public: 28 | 29 | virtual ~JNL_IListen() { } 30 | 31 | virtual JNL_IConnection *get_connect(int sendbufsize=8192, int recvbufsize=8192)=0; 32 | virtual short port(void)=0; 33 | virtual int is_error(void)=0; 34 | }; 35 | 36 | #define JNL_Listen_PARENTDEF : public JNL_IListen 37 | #else 38 | #define JNL_IListen JNL_Listen 39 | #define JNL_Listen_PARENTDEF 40 | #endif 41 | 42 | #ifndef JNL_NO_IMPLEMENTATION 43 | 44 | 45 | class JNL_Listen JNL_Listen_PARENTDEF 46 | { 47 | public: 48 | JNL_Listen(short port, unsigned int which_interface=0); 49 | ~JNL_Listen(); 50 | 51 | JNL_IConnection *get_connect(int sendbufsize=8192, int recvbufsize=8192); 52 | short port(void) { return m_port; } 53 | int is_error(void) { return (m_socket == INVALID_SOCKET); } 54 | 55 | protected: 56 | SOCKET m_socket; 57 | short m_port; 58 | }; 59 | 60 | #endif 61 | 62 | #endif //_LISTEN_H_ 63 | -------------------------------------------------------------------------------- /WDL/jnetlib/netinc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** JNetLib 3 | ** Copyright (C) 2000-2001 Nullsoft, Inc. 4 | ** Author: Justin Frankel 5 | ** File: netinc.h - network includes and portability defines (used internally) 6 | ** License: see jnetlib.h 7 | */ 8 | 9 | #ifndef _NETINC_H_ 10 | #define _NETINC_H_ 11 | 12 | #ifdef _WIN32 13 | 14 | #include 15 | #include 16 | #include 17 | #define JNL_ERRNO (WSAGetLastError()) 18 | #define SET_SOCK_BLOCK(s,block) { unsigned long __i=block?0:1; ioctlsocket(s,FIONBIO,&__i); } 19 | #define SET_SOCK_DEFAULTS(s) do { } while (0) 20 | #define JNL_EWOULDBLOCK WSAEWOULDBLOCK 21 | #define JNL_EINPROGRESS WSAEWOULDBLOCK 22 | #define JNL_ENOTCONN WSAENOTCONN 23 | 24 | typedef int socklen_t; 25 | 26 | #else 27 | 28 | #ifndef THREAD_SAFE 29 | #define THREAD_SAFE 30 | #endif 31 | #ifndef _REENTRANT 32 | #define _REENTRANT 33 | #endif 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | 52 | #define JNL_ERRNO ((errno)|0) 53 | #define closesocket(s) close(s) 54 | #define SET_SOCK_BLOCK(s,block) { int __flags; if ((__flags = fcntl(s, F_GETFL, 0)) != -1) { if (!block) __flags |= O_NONBLOCK; else __flags &= ~O_NONBLOCK; fcntl(s, F_SETFL, __flags); } } 55 | #ifdef __APPLE__ 56 | #define SET_SOCK_DEFAULTS(s) do { int __flags = 1; setsockopt((s), SOL_SOCKET, SO_NOSIGPIPE, &__flags, sizeof(__flags)); } while (0) 57 | #else 58 | #define SET_SOCK_DEFAULTS(s) do { } while (0) 59 | #endif 60 | 61 | typedef int SOCKET; 62 | #define INVALID_SOCKET (-1) 63 | 64 | #define JNL_EWOULDBLOCK EWOULDBLOCK 65 | #define JNL_EINPROGRESS EINPROGRESS 66 | #define JNL_ENOTCONN ENOTCONN 67 | 68 | #ifndef stricmp 69 | #define stricmp(x,y) strcasecmp(x,y) 70 | #endif 71 | #ifndef strnicmp 72 | #define strnicmp(x,y,z) strncasecmp(x,y,z) 73 | #endif 74 | 75 | #endif // !_WIN32 76 | 77 | #ifndef INADDR_NONE 78 | #define INADDR_NONE 0xffffffff 79 | #endif 80 | 81 | #ifndef INADDR_ANY 82 | #define INADDR_ANY 0 83 | #endif 84 | 85 | #ifndef SHUT_RDWR 86 | #define SHUT_RDWR 2 87 | #endif 88 | 89 | #endif //_NETINC_H_ 90 | -------------------------------------------------------------------------------- /WDL/jnetlib/test.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "test"=.\test.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /WDL/jnetlib/testbnc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ** JNetLib 3 | ** Copyright (C) 2000-2001 Nullsoft, Inc. 4 | ** Author: Justin Frankel 5 | ** File: testbnc.cpp - JNL network bounce test code 6 | ** License: see jnetlib.h 7 | */ 8 | 9 | #ifdef _WIN32 10 | #include 11 | #else 12 | #define Sleep(x) usleep((x)*1000) 13 | #endif 14 | #include 15 | #include "jnetlib.h" 16 | 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | JNL_Connection *cons[32]={0,}; 21 | JNL_Connection *outcons[32]={0,}; 22 | int n_cons=0; 23 | 24 | if (argc != 4 || !atoi(argv[1]) || !atoi(argv[3]) || !argv[2][0]) 25 | { 26 | printf("usage: redir localport host remoteport\n"); 27 | exit(1); 28 | } 29 | 30 | JNL::open_socketlib(); 31 | JNL_AsyncDNS dns; 32 | JNL_Listen l((short)atoi(argv[1])); 33 | printf("running...\n"); 34 | while (!l.is_error()) 35 | { 36 | Sleep(10); 37 | if (n_cons<32) 38 | { 39 | JNL_Connection *con=l.get_connect(); 40 | if (con) 41 | { 42 | int x; 43 | for (x = 0; x < 32; x ++) 44 | { 45 | if (!cons[x]) 46 | { 47 | outcons[x]=new JNL_Connection(); 48 | outcons[x]->connect(argv[2],atoi(argv[3])); 49 | cons[x]=con; 50 | char host[256]; 51 | JNL::addr_to_ipstr(cons[x]->get_remote(),host,sizeof(host)); 52 | n_cons++; 53 | printf("Connection %d (%s) opened (%d).\n",x,host,n_cons); 54 | break; 55 | } 56 | } 57 | } 58 | } 59 | int x; 60 | for (x = 0; x < 32; x ++) 61 | { 62 | if (cons[x]) 63 | { 64 | cons[x]->run(); 65 | outcons[x]->run(); 66 | 67 | int cerr=(cons[x]->get_state() == JNL_Connection::STATE_ERROR || cons[x]->get_state()==JNL_Connection::STATE_CLOSED); 68 | int oerr=(outcons[x]->get_state() == JNL_Connection::STATE_ERROR || outcons[x]->get_state()==JNL_Connection::STATE_CLOSED); 69 | 70 | if ((!outcons[x]->send_bytes_in_queue() && !cons[x]->recv_bytes_available() && cerr) || 71 | (!cons[x]->send_bytes_in_queue() && !outcons[x]->recv_bytes_available() && oerr) || 72 | (cerr && oerr)) 73 | { 74 | char host[256]; 75 | JNL::addr_to_ipstr(cons[x]->get_remote(),host,sizeof(host)); 76 | delete cons[x]; 77 | delete outcons[x]; 78 | outcons[x]=0; 79 | cons[x]=0; 80 | n_cons--; 81 | printf("Connection %d (%s) closed (%d)\n",x,host,n_cons); 82 | } 83 | else 84 | { 85 | char buf[4096]; 86 | int l; 87 | l=outcons[x]->send_bytes_available(); 88 | if (l > 4096) l=4096; 89 | if (l) l=cons[x]->recv_bytes(buf,l); 90 | if (l) outcons[x]->send(buf,l); 91 | 92 | l=cons[x]->send_bytes_available(); 93 | if (l > 4096) l=4096; 94 | if (l) l=outcons[x]->recv_bytes(buf,l); 95 | if (l) cons[x]->send(buf,l); 96 | } 97 | } 98 | } 99 | } 100 | JNL::close_socketlib(); 101 | return 0; 102 | } 103 | -------------------------------------------------------------------------------- /WDL/jnetlib/util.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ** JNetLib 3 | ** Copyright (C) 2000-2001 Nullsoft, Inc. 4 | ** Author: Justin Frankel 5 | ** File: util.cpp - JNL implementation of basic network utilities 6 | ** License: see jnetlib.h 7 | */ 8 | 9 | #include "netinc.h" 10 | 11 | #include "util.h" 12 | 13 | int JNL::open_socketlib() 14 | { 15 | #ifdef _WIN32 16 | WSADATA wsaData; 17 | if (WSAStartup(MAKEWORD(1, 1), &wsaData)) return 1; 18 | #endif 19 | return 0; 20 | } 21 | void JNL::close_socketlib() 22 | { 23 | #ifdef _WIN32 24 | WSACleanup(); 25 | #endif 26 | } 27 | unsigned int JNL::ipstr_to_addr(const char *cp) 28 | { 29 | return ::inet_addr(cp); 30 | } 31 | 32 | void JNL::addr_to_ipstr(unsigned int addr, char *host, int maxhostlen) 33 | { 34 | struct in_addr a; a.s_addr=addr; 35 | char *p=::inet_ntoa(a); strncpy(host,p?p:"",maxhostlen); 36 | } 37 | -------------------------------------------------------------------------------- /WDL/jnetlib/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** JNetLib 3 | ** Copyright (C) 2000-2001 Nullsoft, Inc. 4 | ** Author: Justin Frankel 5 | ** File: util.h - JNL interface for basic network utilities 6 | ** License: see jnetlib.h 7 | ** 8 | ** routines you may be interested in: 9 | ** JNL::open_socketlib(); 10 | ** opens the socket library. Call this once before using any network 11 | ** code. If you create a new thread, call this again. Only really an 12 | ** issue for Win32 support, but use it anyway for portability/ 13 | ** 14 | ** JNL::close_Socketlib(); 15 | ** closes the socketlib. Call this when you're done with the network, 16 | ** after all your JNetLib objects have been destroyed. 17 | ** 18 | ** unsigned int JNL::ipstr_to_addr(const char *cp); 19 | ** gives you the integer representation of a ip address in dotted 20 | ** decimal form. 21 | ** 22 | ** JNL::addr_to_ipstr(unsigned int addr, char *host, int maxhostlen); 23 | ** gives you the dotted decimal notation of an integer ip address. 24 | ** 25 | */ 26 | 27 | #ifndef _UTIL_H_ 28 | #define _UTIL_H_ 29 | 30 | class JNL 31 | { 32 | public: 33 | static int open_socketlib(); 34 | static void close_socketlib(); 35 | static unsigned int ipstr_to_addr(const char *cp); 36 | static void addr_to_ipstr(unsigned int addr, char *host, int maxhostlen); 37 | }; 38 | 39 | #endif //_UTIL_H_ 40 | -------------------------------------------------------------------------------- /WDL/jpeglib/jchuff.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jchuff.h 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains declarations for Huffman entropy encoding routines 9 | * that are shared between the sequential encoder (jchuff.c) and the 10 | * progressive encoder (jcphuff.c). No other modules need to see these. 11 | */ 12 | 13 | /* The legal range of a DCT coefficient is 14 | * -1024 .. +1023 for 8-bit data; 15 | * -16384 .. +16383 for 12-bit data. 16 | * Hence the magnitude should always fit in 10 or 14 bits respectively. 17 | */ 18 | 19 | #if BITS_IN_JSAMPLE == 8 20 | #define MAX_COEF_BITS 10 21 | #else 22 | #define MAX_COEF_BITS 14 23 | #endif 24 | 25 | /* Derived data constructed for each Huffman table */ 26 | 27 | typedef struct { 28 | unsigned int ehufco[256]; /* code for each symbol */ 29 | char ehufsi[256]; /* length of code for each symbol */ 30 | /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */ 31 | } c_derived_tbl; 32 | 33 | /* Short forms of external names for systems with brain-damaged linkers. */ 34 | 35 | #ifdef NEED_SHORT_EXTERNAL_NAMES 36 | #define jpeg_make_c_derived_tbl jMkCDerived 37 | #define jpeg_gen_optimal_table jGenOptTbl 38 | #endif /* NEED_SHORT_EXTERNAL_NAMES */ 39 | 40 | /* Expand a Huffman table definition into the derived format */ 41 | EXTERN(void) jpeg_make_c_derived_tbl 42 | JPP((j_compress_ptr cinfo, boolean isDC, int tblno, 43 | c_derived_tbl ** pdtbl)); 44 | 45 | /* Generate an optimal table definition given the specified counts */ 46 | EXTERN(void) jpeg_gen_optimal_table 47 | JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); 48 | -------------------------------------------------------------------------------- /WDL/jpeglib/jcinit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jcinit.c 3 | * 4 | * Copyright (C) 1991-1997, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains initialization logic for the JPEG compressor. 9 | * This routine is in charge of selecting the modules to be executed and 10 | * making an initialization call to each one. 11 | * 12 | * Logically, this code belongs in jcmaster.c. It's split out because 13 | * linking this routine implies linking the entire compression library. 14 | * For a transcoding-only application, we want to be able to use jcmaster.c 15 | * without linking in the whole library. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | 22 | 23 | /* 24 | * Master selection of compression modules. 25 | * This is done once at the start of processing an image. We determine 26 | * which modules will be used and give them appropriate initialization calls. 27 | */ 28 | 29 | GLOBAL(void) 30 | jinit_compress_master (j_compress_ptr cinfo) 31 | { 32 | /* Initialize master control (includes parameter checking/processing) */ 33 | jinit_c_master_control(cinfo, FALSE /* full compression */); 34 | 35 | /* Preprocessing */ 36 | if (! cinfo->raw_data_in) { 37 | jinit_color_converter(cinfo); 38 | jinit_downsampler(cinfo); 39 | jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */); 40 | } 41 | /* Forward DCT */ 42 | jinit_forward_dct(cinfo); 43 | /* Entropy encoding: either Huffman or arithmetic coding. */ 44 | if (cinfo->arith_code) { 45 | ERREXIT(cinfo, JERR_ARITH_NOTIMPL); 46 | } else { 47 | if (cinfo->progressive_mode) { 48 | #ifdef C_PROGRESSIVE_SUPPORTED 49 | jinit_phuff_encoder(cinfo); 50 | #else 51 | ERREXIT(cinfo, JERR_NOT_COMPILED); 52 | #endif 53 | } else 54 | jinit_huff_encoder(cinfo); 55 | } 56 | 57 | /* Need a full-image coefficient buffer in any multi-pass mode. */ 58 | jinit_c_coef_controller(cinfo, 59 | (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); 60 | jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); 61 | 62 | jinit_marker_writer(cinfo); 63 | 64 | /* We can now tell the memory manager to allocate virtual arrays. */ 65 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); 66 | 67 | /* Write the datastream header (SOI) immediately. 68 | * Frame and scan headers are postponed till later. 69 | * This lets application insert special markers after the SOI. 70 | */ 71 | (*cinfo->marker->write_file_header) (cinfo); 72 | } 73 | -------------------------------------------------------------------------------- /WDL/jpeglib/jconfig.h: -------------------------------------------------------------------------------- 1 | #define HAVE_PROTOTYPES 2 | #define HAVE_STDLIB_H 3 | #define HAVE_UNSIGNED_SHORT 4 | #define HAVE_UNSIGNED_CHAR 5 | #ifndef _WIN32 6 | #define NEED_SYS_TYPES_H 7 | #define HAVE_STDDEF_H 8 | #else 9 | #include 10 | #define XMD_H 11 | #undef FAR 12 | #define HAVE_BOOLEAN 13 | typedef short INT16; 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /WDL/jpeglib/jmemnobs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jmemnobs.c 3 | * 4 | * Copyright (C) 1992-1996, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file provides a really simple implementation of the system- 9 | * dependent portion of the JPEG memory manager. This implementation 10 | * assumes that no backing-store files are needed: all required space 11 | * can be obtained from malloc(). 12 | * This is very portable in the sense that it'll compile on almost anything, 13 | * but you'd better have lots of main memory (or virtual memory) if you want 14 | * to process big images. 15 | * Note that the max_memory_to_use option is ignored by this implementation. 16 | */ 17 | 18 | #define JPEG_INTERNALS 19 | #include "jinclude.h" 20 | #include "jpeglib.h" 21 | #include "jmemsys.h" /* import the system-dependent declarations */ 22 | 23 | #ifndef HAVE_STDLIB_H /* should declare malloc(),free() */ 24 | extern void * malloc JPP((size_t size)); 25 | extern void free JPP((void *ptr)); 26 | #endif 27 | 28 | 29 | /* 30 | * Memory allocation and freeing are controlled by the regular library 31 | * routines malloc() and free(). 32 | */ 33 | 34 | GLOBAL(void *) 35 | jpeg_get_small (j_common_ptr cinfo, size_t sizeofobject) 36 | { 37 | return (void *) malloc(sizeofobject); 38 | } 39 | 40 | GLOBAL(void) 41 | jpeg_free_small (j_common_ptr cinfo, void * object, size_t sizeofobject) 42 | { 43 | free(object); 44 | } 45 | 46 | 47 | /* 48 | * "Large" objects are treated the same as "small" ones. 49 | * NB: although we include FAR keywords in the routine declarations, 50 | * this file won't actually work in 80x86 small/medium model; at least, 51 | * you probably won't be able to process useful-size images in only 64KB. 52 | */ 53 | 54 | GLOBAL(void FAR *) 55 | jpeg_get_large (j_common_ptr cinfo, size_t sizeofobject) 56 | { 57 | return (void FAR *) malloc(sizeofobject); 58 | } 59 | 60 | GLOBAL(void) 61 | jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject) 62 | { 63 | free(object); 64 | } 65 | 66 | 67 | /* 68 | * This routine computes the total memory space available for allocation. 69 | * Here we always say, "we got all you want bud!" 70 | */ 71 | 72 | GLOBAL(long) 73 | jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, 74 | long max_bytes_needed, long already_allocated) 75 | { 76 | return max_bytes_needed; 77 | } 78 | 79 | 80 | /* 81 | * Backing store (temporary file) management. 82 | * Since jpeg_mem_available always promised the moon, 83 | * this should never be called and we can just error out. 84 | */ 85 | 86 | GLOBAL(void) 87 | jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, 88 | long total_bytes_needed) 89 | { 90 | ERREXIT(cinfo, JERR_NO_BACKING_STORE); 91 | } 92 | 93 | 94 | /* 95 | * These routines take care of any system-dependent initialization and 96 | * cleanup required. Here, there isn't any. 97 | */ 98 | 99 | GLOBAL(long) 100 | jpeg_mem_init (j_common_ptr cinfo) 101 | { 102 | return 0; /* just set max_memory_to_use to 0 */ 103 | } 104 | 105 | GLOBAL(void) 106 | jpeg_mem_term (j_common_ptr cinfo) 107 | { 108 | /* no work */ 109 | } 110 | -------------------------------------------------------------------------------- /WDL/jpeglib/jversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jversion.h 3 | * 4 | * Copyright (C) 1991-1998, Thomas G. Lane. 5 | * This file is part of the Independent JPEG Group's software. 6 | * For conditions of distribution and use, see the accompanying README file. 7 | * 8 | * This file contains software version identification. 9 | */ 10 | 11 | 12 | #define JVERSION "6b 27-Mar-1998" 13 | 14 | #define JCOPYRIGHT "Copyright (C) 1998, Thomas G. Lane" 15 | -------------------------------------------------------------------------------- /WDL/lameencdec.h: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - lameencdec.h 3 | Copyright (C) 2005 and later Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | 22 | This file provides a simple interface for using lame_enc/libmp3lame MP3 encoding 23 | 24 | */ 25 | 26 | 27 | #ifndef _LAMEENCDEC_H_ 28 | #define _LAMEENCDEC_H_ 29 | 30 | #include "queue.h" 31 | #include "wdlstring.h" 32 | #include "assocarray.h" 33 | 34 | class LameEncoder 35 | { 36 | public: 37 | 38 | LameEncoder(int srate, int nch, int bitrate, int stereomode=1, int quality=2, 39 | int vbrmethod=-1, int vbrquality=2, int vbrmax=320, int abr=128, int rpgain=0, 40 | WDL_StringKeyedArray *metadata=NULL); 41 | ~LameEncoder(); 42 | 43 | int Status() { return errorstat; } // 1=no dll, 2=error 44 | 45 | void Encode(float *in, int in_spls, int spacing=1); 46 | 47 | WDL_Queue outqueue; 48 | 49 | void reinit() 50 | { 51 | spltmp[0].Advance(spltmp[0].Available()); 52 | spltmp[0].Compact(); 53 | spltmp[1].Advance(spltmp[1].Available()); 54 | spltmp[1].Compact(); 55 | } 56 | 57 | static const char *GetInfo(); 58 | static const char *GetLibName(); 59 | static int CheckDLL(); // returns >0 if DLL present, 1 for lame, 2 for old bladeenc 60 | static void InitDLL(const char *extrapath=NULL, bool forceRetry=false); // call with extrapath != NULL if you want to try loading from another path 61 | 62 | void SetVBRFilename(const char *fn) 63 | { 64 | m_vbrfile.Set(fn); 65 | } 66 | 67 | int GetNumChannels() { return m_encoder_nch; } 68 | 69 | private: 70 | 71 | void SetMetadata(WDL_StringKeyedArray *metadata); 72 | int m_id3_len; 73 | 74 | void *m_lamestate; 75 | WDL_Queue spltmp[2]; 76 | WDL_HeapBuf outtmp; 77 | WDL_String m_vbrfile; 78 | int errorstat; 79 | int in_size_samples; 80 | int m_nch,m_encoder_nch; 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /WDL/lice/lice.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "lice"=.\lice.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "plush2"=..\plush2\plush2.dsp - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Project: "test"=.\test\test.dsp - Package Owner=<4> 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<4> 37 | {{{ 38 | Begin Project Dependency 39 | Project_Dep_Name lice 40 | End Project Dependency 41 | Begin Project Dependency 42 | Project_Dep_Name plush2 43 | End Project Dependency 44 | }}} 45 | 46 | ############################################################################### 47 | 48 | Global: 49 | 50 | Package=<5> 51 | {{{ 52 | }}} 53 | 54 | Package=<3> 55 | {{{ 56 | }}} 57 | 58 | ############################################################################### 59 | 60 | -------------------------------------------------------------------------------- /WDL/lice/lice_gl_ctx.h: -------------------------------------------------------------------------------- 1 | #ifndef _GL_CTX_ 2 | #define _GL_CTX_ 3 | 4 | #include "lice.h" 5 | 6 | #define GLEW_STATIC 7 | #include "glew/include/gl/glew.h" 8 | #include "glew/include/gl/wglew.h" 9 | #include "glew/include/gl/wglext.h" 10 | 11 | // GL context functions 12 | // opening and managing GL context is handled behind the scenes 13 | 14 | 15 | bool LICE_GL_IsValid(); // GL context is initialized (will be lazy initialized on first call) and valid 16 | 17 | HWND LICE_GL_GetWindow(); // Get the window that owns the GL context (one per process) 18 | 19 | void LICE_GL_CloseCtx(); // Something failed, turn off GL context forever so we don't keep failing 20 | 21 | GLUnurbsObj* LICE_GL_GetNurbsObj(int linetol=8); // linetol = maximum number of straight-line pixels 22 | 23 | // facility for associating a glyph with a texture 24 | GLuint LICE_GL_GetTexFromGlyph(const unsigned char* glyph, int glyph_w, int glyph_h); 25 | void LICE_GL_ClearTex(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /WDL/lice/lice_glbitmap.h: -------------------------------------------------------------------------------- 1 | #include "lice.h" 2 | #include "lice_extended.h" 3 | 4 | // interface class for LICE_GL_SysBitmap and LICE_GL_MemBitmap 5 | class LICE_GLBitmap : public LICE_IBitmap 6 | { 7 | public: 8 | 9 | LICE_GLBitmap(); 10 | ~LICE_GLBitmap(); 11 | 12 | LICE_pixel* getBits(); 13 | 14 | int getWidth(); 15 | int getHeight(); 16 | int getRowSpan(); 17 | 18 | bool resize(int w, int h); 19 | 20 | virtual HDC getDC() = 0; // re-virtualize this to prevent instantiating LICE_GLBitmap directly 21 | 22 | INT_PTR Extended(int id, void* data); 23 | 24 | private: 25 | 26 | bool Clear_accel(LICE_pixel* color); 27 | bool Line_accel(LICE_Ext_Line_acceldata* p); 28 | bool FillRect_accel(LICE_Ext_FillRect_acceldata* p); 29 | bool DrawCBezier_accel(LICE_Ext_DrawCBezier_acceldata* p); 30 | bool DrawGlyph_accel(LICE_Ext_DrawGlyph_acceldata* p); 31 | bool Blit_accel(LICE_Ext_Blit_acceldata* p); 32 | bool ScaledBlit_accel(LICE_Ext_ScaledBlit_acceldata* p); 33 | bool DashedLine_accel(LICE_Ext_DashedLine_acceldata* p); 34 | bool GetPixel_accel(LICE_Ext_GetPixel_acceldata* p); 35 | bool PutPixel_accel(LICE_Ext_PutPixel_acceldata* p); 36 | bool SetClip_ext(LICE_Ext_SetClip_data* p); 37 | bool DrawTriangle_accel(LICE_Ext_DrawTriangle_acceldata *p); 38 | // etc 39 | 40 | bool WindowBlit(LICE_Ext_WindowBlit_data* p); 41 | 42 | bool CreateFBO(int w, int h); 43 | bool BindFBO(); // bind this FBO so it is the current rendering target, and test for validity 44 | void ReleaseFBO(); 45 | 46 | unsigned int m_fbo; // framebuffer object: rendering target for drawing on this glbitmap 47 | unsigned int m_tex; // texture object: backing store for this framebuffer object 48 | 49 | enum { EMPTY, INGPU, INMEM }; 50 | int m_bufloc; // where is the current framebuffer? 51 | LICE_IBitmap* m_bmp; 52 | 53 | protected: 54 | 55 | void Init(LICE_IBitmap* bmp, int w, int h); 56 | bool FramebufferToGPU(); 57 | void FramebufferFromGPU(); 58 | }; 59 | 60 | class LICE_GL_SysBitmap : public LICE_GLBitmap 61 | { 62 | public: 63 | 64 | LICE_GL_SysBitmap(int w=0, int h=0); 65 | 66 | HDC getDC(); 67 | 68 | private: 69 | 70 | LICE_SysBitmap m_sysbmp; 71 | }; 72 | 73 | 74 | class LICE_GL_MemBitmap : public LICE_GLBitmap 75 | { 76 | public: 77 | 78 | LICE_GL_MemBitmap(int w=0, int h=0); 79 | 80 | HDC getDC() { return 0; } 81 | 82 | private: 83 | 84 | LICE_MemBitmap m_membmp; 85 | }; 86 | 87 | 88 | class LICE_GL_SubBitmap : public LICE_IBitmap 89 | { 90 | public: 91 | 92 | LICE_GL_SubBitmap(LICE_IBitmap *parent, int x, int y, int w, int h); 93 | 94 | LICE_pixel* getBits(); 95 | 96 | int getWidth() { return m_w; } 97 | int getHeight() { return m_h; } 98 | int getRowSpan() { return (m_parent ? m_parent->getRowSpan() : 0); } 99 | 100 | bool resize(int w, int h); 101 | 102 | HDC getDC() { return (m_parent ? m_parent->getDC() : 0); } 103 | 104 | INT_PTR Extended(int id, void* data); 105 | 106 | private: 107 | 108 | LICE_IBitmap* m_parent; 109 | int m_x, m_y, m_w, m_h; 110 | }; 111 | -------------------------------------------------------------------------------- /WDL/lice/lice_lcf.h: -------------------------------------------------------------------------------- 1 | #ifndef _LICE_LCF_H_ 2 | #define _LICE_LCF_H_ 3 | 4 | #include "../zlib/zlib.h" 5 | #include "lice.h" 6 | 7 | #include "../ptrlist.h" 8 | #include "../queue.h" 9 | class WDL_FileWrite; 10 | class WDL_FileRead; 11 | 12 | class LICECaptureCompressor 13 | { 14 | public: 15 | LICECaptureCompressor(const char *outfn, int w, int h, int interval=20, int bsize_w=128, int bsize_h=16); 16 | 17 | ~LICECaptureCompressor(); 18 | 19 | bool IsOpen() { return !!m_file; } 20 | void OnFrame(LICE_IBitmap *fr, int delta_t_ms); 21 | 22 | WDL_INT64 GetOutSize() { return m_outsize; } 23 | WDL_INT64 GetInSize() { return m_inbytes; } 24 | 25 | private: 26 | WDL_FileWrite *m_file; 27 | WDL_INT64 m_outsize,m_inbytes; 28 | int m_inframes, m_outframes; 29 | 30 | int m_w,m_h,m_interval,m_bsize_w,m_bsize_h; 31 | 32 | 33 | struct frameRec 34 | { 35 | frameRec(int sz) { data=(unsigned short *)malloc(sz*sizeof(short)); delta_t_ms=0; } 36 | ~frameRec() { free(data); } 37 | unsigned short *data; // shorts 38 | int delta_t_ms; // time (ms) since last frame 39 | }; 40 | WDL_PtrList m_framelists[2]; 41 | WDL_Queue m_current_block; 42 | WDL_Queue m_hdrqueue; 43 | 44 | int m_state, m_which,m_outchunkpos,m_numrows,m_numcols; 45 | int m_current_block_srcsize; 46 | 47 | z_stream m_compstream; 48 | 49 | void BitmapToFrameRec(LICE_IBitmap *fr, frameRec *dest); 50 | void DeflateBlock(void *data, int data_size, bool flush); 51 | void AddHdrInt(int a) { m_hdrqueue.AddToLE(&a); } 52 | 53 | 54 | }; 55 | 56 | 57 | class LICECaptureDecompressor 58 | { 59 | public: 60 | LICECaptureDecompressor(const char *fn, bool want_seekable=false); 61 | ~LICECaptureDecompressor(); 62 | 63 | 64 | bool IsOpen() { return !!m_file; } 65 | 66 | // only supported if want_seekable=true 67 | int GetLength() { return m_file_length_ms; } // length in ms 68 | int Seek(unsigned int offset_ms); // return -1 on fail (out of range), or >0 to tell you how far into the frame you seeked (0=exact hit) 69 | 70 | bool NextFrame(); // TRUE if out of frames 71 | LICE_IBitmap *GetCurrentFrame(); // can return NULL if error 72 | int GetTimeToNextFrame(); // delta in ms 73 | 74 | int GetWidth(){ return m_curhdr[m_rd_which].w; } 75 | int GetHeight(){ return m_curhdr[m_rd_which].h; } 76 | 77 | int m_bytes_read; // increases for statistics, caller can clear 78 | 79 | private: 80 | LICE_MemBitmap m_workbm; 81 | 82 | struct hdrType 83 | { 84 | int bpp; 85 | int w, h; 86 | int bsize_w, bsize_h; 87 | int cdata_left; 88 | } m_curhdr[2]; 89 | 90 | int m_rd_which; 91 | int m_frameidx; 92 | 93 | bool ReadHdr(int whdr); 94 | bool DecompressBlock(int whdr, double percent=1.0); 95 | 96 | z_stream m_compstream; 97 | WDL_Queue m_tmp; 98 | 99 | WDL_FileRead *m_file; 100 | 101 | unsigned int m_file_length_ms; 102 | WDL_TypedQueue m_file_frame_info; //pairs of offset_bytes, offset_ms 103 | 104 | WDL_TypedBuf m_frame_deltas[2]; 105 | WDL_HeapBuf m_decompdata[2]; 106 | WDL_TypedBuf m_slices; // indexed by [frame][slice] 107 | 108 | void DecodeSlices(); 109 | }; 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /WDL/lice/lice_pcx.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Cockos WDL - LICE - Lightweight Image Compositing Engine 3 | Copyright (C) 2007 and later, Cockos Incorporated 4 | File: lice_pcx.cpp (PCX loading for LICE) 5 | See lice.h for license and other information 6 | */ 7 | 8 | #include "lice.h" 9 | #include "../wdltypes.h" 10 | 11 | #include 12 | 13 | // note: you'd never really want to use PCX files, but in case you do... 14 | 15 | LICE_IBitmap *LICE_LoadPCX(const char *filename, LICE_IBitmap *_bmp) 16 | { 17 | FILE *fp = fopen(filename,"rb"); 18 | if(!fp) return 0; 19 | 20 | fgetc(fp); 21 | if (fgetc(fp) != 5) { fclose(fp); return NULL; } 22 | if (fgetc(fp) != 1) { fclose(fp); return NULL; } 23 | if (fgetc(fp) != 8) { fclose(fp); return NULL; } 24 | 25 | int sx = fgetc(fp); sx += fgetc(fp)<<8; 26 | int sy = fgetc(fp); sy += fgetc(fp)<<8; 27 | int ex = fgetc(fp); ex += fgetc(fp)<<8; 28 | int ey = fgetc(fp); ey += fgetc(fp)<<8; 29 | 30 | 31 | unsigned char pal[768]; 32 | fseek(fp,-769,SEEK_END); 33 | if (fgetc(fp) != 12) { fclose(fp); return NULL; } 34 | fread(pal,1,768,fp); 35 | if (feof(fp)) { fclose(fp); return NULL; } 36 | 37 | 38 | LICE_IBitmap *usebmp = NULL; 39 | if (_bmp) (usebmp=_bmp)->resize(ex-sx+1,ey-sy+1); 40 | else usebmp = new WDL_NEW LICE_MemBitmap(ex-sx+1,ey-sy+1); 41 | if (!usebmp || usebmp->getWidth() != (ex-sx+1) || usebmp->getHeight() != (ey-sy+1)) 42 | { 43 | if (usebmp != _bmp) delete usebmp; 44 | fclose(fp); 45 | return NULL; 46 | } 47 | 48 | fseek(fp,128,SEEK_SET); 49 | 50 | LICE_Clear(usebmp,0); 51 | int y = usebmp->getHeight(); 52 | int w = usebmp->getWidth(); 53 | int rowspan = usebmp->getRowSpan(); 54 | LICE_pixel *pout = usebmp->getBits(); 55 | if (usebmp->isFlipped()) 56 | { 57 | pout += rowspan*(y-1); 58 | rowspan=-rowspan; 59 | } 60 | while (y--) 61 | { 62 | int xpos = 0; 63 | while (xpos < w) 64 | { 65 | int c = fgetc(fp); 66 | if (c&~255) break; 67 | if ((c & 192) == 192) 68 | { 69 | int oc = (fgetc(fp))&255; 70 | LICE_pixel t=LICE_RGBA(pal[oc*3],pal[oc*3+1],pal[oc*3+2],255); 71 | 72 | c&=63; 73 | while (c-- && xposfilename && *p != '\\' && *p != '/' && *p != '.') p--; 104 | if (stricmp(p,".pcx")) return 0; 105 | } 106 | return LICE_LoadPCX(filename,bmpbase); 107 | } 108 | static const char *get_extlist() 109 | { 110 | return "PCX files (*.PCX)\0*.PCX\0"; 111 | } 112 | 113 | }; 114 | 115 | LICE_PCXLoader LICE_pcxldr; -------------------------------------------------------------------------------- /WDL/lice/test/Controller.h: -------------------------------------------------------------------------------- 1 | /* Controller */ 2 | 3 | #import 4 | 5 | @interface Controller : NSObject 6 | { 7 | } 8 | -(void)awakeFromNib; 9 | @end 10 | -------------------------------------------------------------------------------- /WDL/lice/test/Controller.mm: -------------------------------------------------------------------------------- 1 | #import "Controller.h" 2 | 3 | #include "main.cpp" // this would otherwise conflict in object name with main.m, which xcode made us. 4 | 5 | 6 | @implementation Controller 7 | -(void)awakeFromNib 8 | { 9 | SWELL_RegisterCustomControlCreator(ccontrolCreator); 10 | HWND h=CreateDialog(NULL,MAKEINTRESOURCE(IDD_DIALOG1),NULL,dlgProc); 11 | ShowWindow(h,SW_SHOW); 12 | } 13 | @end 14 | -------------------------------------------------------------------------------- /WDL/lice/test/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinfrankel/oscii-bot/8ffdbe6398315d58721b3b8efa0069a8f269f3a7/WDL/lice/test/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /WDL/lice/test/English.lproj/MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = Controller; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /WDL/lice/test/English.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 110 86 356 240 0 0 1440 878 7 | IBEditorPositions 8 | 9 | 29 10 | 109 299 338 44 0 0 1440 878 11 | 12 | IBFramework Version 13 | 446.1 14 | IBOpenObjects 15 | 16 | 29 17 | 18 | IBSystem Version 19 | 8R2232 20 | 21 | 22 | -------------------------------------------------------------------------------- /WDL/lice/test/English.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinfrankel/oscii-bot/8ffdbe6398315d58721b3b8efa0069a8f269f3a7/WDL/lice/test/English.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /WDL/lice/test/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.yourcompany.test 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /WDL/lice/test/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-O2 -g -Wall 2 | LFLAGS= 3 | CC=gcc 4 | CXX=g++ 5 | WDL_PATH=../.. 6 | 7 | ifdef NOSWELL 8 | CFLAGS += -D_LICE_NO_SYSBITMAPS_ 9 | SWELL_OBJS = 10 | else 11 | CFLAGS += -DSWELL_LICE_GDI 12 | 13 | ifdef GDK2 14 | CFLAGS += -DSWELL_TARGET_GDK=2 $(shell pkg-config --cflags gdk-2.0) 15 | LFLAGS += $(shell pkg-config --libs gdk-2.0) -lX11 -lXi 16 | else 17 | CFLAGS += -DSWELL_TARGET_GDK=3 $(shell pkg-config --cflags gdk-3.0) 18 | LFLAGS += $(shell pkg-config --libs gdk-3.0) -lX11 -lXi 19 | endif 20 | ifndef NOFREETYPE 21 | CFLAGS += -DSWELL_FREETYPE $(shell freetype-config --cflags) 22 | LFLAGS += $(shell freetype-config --libs) 23 | endif 24 | 25 | SWELL_OBJS = swell-wnd-generic.o swell-gdi-lice.o swell.o swell-misc-generic.o \ 26 | swell-dlg-generic.o swell-menu-generic.o swell-kb-generic.o \ 27 | swell-gdi-generic.o swell-ini.o swell-generic-gdk.o 28 | 29 | LFLAGS += -ldl 30 | 31 | vpath %.cpp $(WDL_PATH)/swell 32 | endif 33 | 34 | CXXFLAGS=$(CFLAGS) 35 | 36 | vpath %.c $(WDL_PATH)/zlib $(WDL_PATH)/libpng $(WDL_PATH)/jpeglib $(WDL_PATH)/giflib $(WDL_PATH)/tinyxml 37 | vpath %.cpp $(WDL_PATH)/lice $(WDL_PATH)/plush2 $(WDL_PATH)/tinyxml 38 | 39 | ZLIB_OBJS = compress.o adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o ioapi.o zip.o unzip.o 40 | 41 | PNGLIB_OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o pngtrans.o 42 | 43 | JPEGLIB_OBJS = jcomapi.o jdapimin.o jdapistd.o jdatadst.o jdatasrc.o jdcoefct.o jdcolor.o jddctmgr.o jdhuff.o jdinput.o jdmainct.o jdmarker.o \ 44 | jdmaster.o jdmerge.o jdphuff.o jdpostct.o jdsample.o jerror.o jfdctflt.o jfdctfst.o jfdctint.o jidctflt.o jidctfst.o jidctint.o \ 45 | jidctred.o jmemmgr.o jmemnobs.o jquant1.o jquant2.o jutils.o 46 | 47 | GIFLIB_OBJS = dgif_lib.o egif_lib.o gifalloc.o gif_hash.o 48 | 49 | LICEOBJS = lice.o lice_gif.o lice_gif_write.o lice_image.o lice_jpg.o lice_png.o lice_pcx.o lice_palette.o lice_line.o lice_arc.o lice_text.o lice_textnew.o lice_texgen.o 50 | 51 | PLUSH_OBJS = pl_cam.o pl_make.o pl_math.o pl_obj.o pl_putface.o pl_read_3ds.o pl_read_cob.o pl_read_jaw.o pl_spline.o 52 | 53 | SVG_OBJS = svgtiny_colors.o tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o lice_svg.o 54 | 55 | .phony: clean default 56 | 57 | default: test 58 | 59 | test: $(LICEOBJS) $(JPEGLIB_OBJS) $(PNGLIB_OBJS) $(ZLIB_OBJS) $(GIFLIB_OBJS) $(SWELL_OBJS) $(PLUSH_OBJS) $(SVG_OBJS) main.o fly.o 60 | $(CXX) $(CFLAGS) -o $@ $^ $(LFLAGS) 61 | 62 | 63 | imgs2gif: $(LICEOBJS) $(JPEGLIB_OBJS) $(PNGLIB_OBJS) $(ZLIB_OBJS) $(GIFLIB_OBJS) $(SWELL_OBJS) imgs2gif.o 64 | $(CXX) $(CFLAGS) -o $@ $^ $(LFLAGS) 65 | 66 | clean: 67 | -rm $(LICEOBJS) $(JPEGLIB_OBJS) $(PNGLIB_OBJS) $(ZLIB_OBJS) $(GIFLIB_OBJS) imgs2gif.o imgs2gif $(SWELL_OBJS) $(PLUSH_OBJS) $(SVG_OBJS) test main.o fly.o 68 | -------------------------------------------------------------------------------- /WDL/lice/test/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinfrankel/oscii-bot/8ffdbe6398315d58721b3b8efa0069a8f269f3a7/WDL/lice/test/image.png -------------------------------------------------------------------------------- /WDL/lice/test/main.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinfrankel/oscii-bot/8ffdbe6398315d58721b3b8efa0069a8f269f3a7/WDL/lice/test/main.ico -------------------------------------------------------------------------------- /WDL/lice/test/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // test 4 | // 5 | // Created by Justin Frankel on 11/9/07. 6 | // Copyright __MyCompanyName__ 2007. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /WDL/lice/test/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by test.rc 4 | // 5 | #define IDD_DIALOG1 101 6 | #define IDC_PNG1 102 7 | #define IDI_MAIN 103 8 | #define IDC_BUTTON1 1000 9 | #define IDC_RECT 1001 10 | #define IDC_BUTTON2 1002 11 | #define IDC_COMBO1 1002 12 | #define IDC_BUTTON3 1003 13 | #define IDC_BUTTON4 1004 14 | #define IDC_BUTTON5 1005 15 | #define IDC_BUTTON6 1006 16 | #define IDC_BUTTON7 1007 17 | 18 | // Next default values for new objects 19 | // 20 | #ifdef APSTUDIO_INVOKED 21 | #ifndef APSTUDIO_READONLY_SYMBOLS 22 | #define _APS_NEXT_RESOURCE_VALUE 104 23 | #define _APS_NEXT_COMMAND_VALUE 40001 24 | #define _APS_NEXT_CONTROL_VALUE 1003 25 | #define _APS_NEXT_SYMED_VALUE 101 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /WDL/lice/test/test.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE DISCARDABLE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE DISCARDABLE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE DISCARDABLE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // 52 | // Dialog 53 | // 54 | 55 | IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 398, 270 56 | STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME 57 | CAPTION "LICE Test App" 58 | FONT 8, "MS Sans Serif" 59 | BEGIN 60 | CONTROL "",IDC_RECT,"Static",SS_BLACKRECT | NOT WS_VISIBLE | 61 | WS_DISABLED,7,23,384,239 62 | COMBOBOX IDC_COMBO1,7,7,181,170,CBS_DROPDOWNLIST | WS_VSCROLL | 63 | WS_TABSTOP 64 | END 65 | 66 | 67 | ///////////////////////////////////////////////////////////////////////////// 68 | // 69 | // PNG 70 | // 71 | 72 | IDC_PNG1 PNG DISCARDABLE "image.png" 73 | IDI_MAIN ICON DISCARDABLE "main.ico" 74 | 75 | ///////////////////////////////////////////////////////////////////////////// 76 | // 77 | // DESIGNINFO 78 | // 79 | 80 | #ifdef APSTUDIO_INVOKED 81 | GUIDELINES DESIGNINFO DISCARDABLE 82 | BEGIN 83 | IDD_DIALOG1, DIALOG 84 | BEGIN 85 | LEFTMARGIN, 7 86 | RIGHTMARGIN, 391 87 | TOPMARGIN, 7 88 | BOTTOMMARGIN, 263 89 | END 90 | END 91 | #endif // APSTUDIO_INVOKED 92 | 93 | #endif // English (U.S.) resources 94 | ///////////////////////////////////////////////////////////////////////////// 95 | 96 | 97 | 98 | #ifndef APSTUDIO_INVOKED 99 | ///////////////////////////////////////////////////////////////////////////// 100 | // 101 | // Generated from the TEXTINCLUDE 3 resource. 102 | // 103 | 104 | 105 | ///////////////////////////////////////////////////////////////////////////// 106 | #endif // not APSTUDIO_INVOKED 107 | 108 | -------------------------------------------------------------------------------- /WDL/lice/test/test.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2013 for Windows Desktop 4 | VisualStudioVersion = 12.0.30110.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{58161B74-2237-4F69-B7AA-34106CD68E71}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {58161B74-2237-4F69-B7AA-34106CD68E71}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {58161B74-2237-4F69-B7AA-34106CD68E71}.Debug|Win32.Build.0 = Debug|Win32 18 | {58161B74-2237-4F69-B7AA-34106CD68E71}.Debug|x64.ActiveCfg = Debug|x64 19 | {58161B74-2237-4F69-B7AA-34106CD68E71}.Debug|x64.Build.0 = Debug|x64 20 | {58161B74-2237-4F69-B7AA-34106CD68E71}.Release|Win32.ActiveCfg = Release|Win32 21 | {58161B74-2237-4F69-B7AA-34106CD68E71}.Release|Win32.Build.0 = Release|Win32 22 | {58161B74-2237-4F69-B7AA-34106CD68E71}.Release|x64.ActiveCfg = Release|x64 23 | {58161B74-2237-4F69-B7AA-34106CD68E71}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /WDL/mergesort.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDL_MERGESORT_H_ 2 | #define _WDL_MERGESORT_H_ 3 | 4 | #include "wdltypes.h" 5 | 6 | static void WDL_STATICFUNC_UNUSED WDL_mergesort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *), char *tmpspace) 7 | { 8 | char *b1,*b2; 9 | size_t n1, n2; 10 | 11 | if (nmemb < 2) return; 12 | 13 | n1 = nmemb / 2; 14 | b1 = (char *) base; 15 | n2 = nmemb - n1; 16 | b2 = b1 + (n1 * size); 17 | 18 | if (nmemb>2) 19 | { 20 | WDL_mergesort(b1, n1, size, compar, tmpspace); 21 | WDL_mergesort(b2, n2, size, compar, tmpspace); 22 | } 23 | 24 | 25 | do 26 | { 27 | if (compar(b1, b2) > 0) // out of order, go to full merge 28 | { 29 | size_t sofar = b1-(char*)base; 30 | memcpy(tmpspace,base,sofar); 31 | memcpy(tmpspace+sofar, b2, size); 32 | b2 += size; 33 | n2--; 34 | 35 | char *writeptr=tmpspace+sofar+size; 36 | while (n1 > 0 && n2 > 0) 37 | { 38 | if (compar(b1, b2) > 0) 39 | { 40 | memcpy(writeptr, b2, size); 41 | b2 += size; 42 | n2--; 43 | } 44 | else 45 | { 46 | memcpy(writeptr, b1, size); 47 | b1 += size; 48 | n1--; 49 | } 50 | writeptr += size; 51 | } 52 | 53 | if (n1 > 0) memcpy(writeptr, b1, n1 * size); 54 | memcpy(base, tmpspace, (nmemb - n2) * size); 55 | 56 | break; 57 | } 58 | 59 | // in order, just advance 60 | b1 += size; 61 | n1--; 62 | } 63 | while (n1 > 0 && n2 > 0); 64 | } 65 | 66 | #endif//_WDL_MERGESORT_H_ 67 | -------------------------------------------------------------------------------- /WDL/plush2/pl_math.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Plush Version 1.2 3 | math.c 4 | Math and Matrix Control 5 | Copyright (c) 1996-2000, Justin Frankel 6 | ******************************************************************************/ 7 | 8 | #include "plush.h" 9 | 10 | void plMatrixRotate(pl_Float matrix[], pl_uChar m, pl_Float Deg) { 11 | pl_uChar m1, m2; 12 | double c,s; 13 | double d= Deg * PL_PI / 180.0; 14 | memset(matrix,0,sizeof(pl_Float)*16); 15 | matrix[((m-1)<<2)+m-1] = matrix[15] = 1.0; 16 | m1 = (m % 3); 17 | m2 = ((m1+1) % 3); 18 | c = cos(d); s = sin(d); 19 | matrix[(m1<<2)+m1]=(pl_Float)c; matrix[(m1<<2)+m2]=(pl_Float)s; 20 | matrix[(m2<<2)+m2]=(pl_Float)c; matrix[(m2<<2)+m1]=(pl_Float)-s; 21 | } 22 | 23 | void plMatrixTranslate(pl_Float m[], pl_Float x, pl_Float y, pl_Float z) { 24 | memset(m,0,sizeof(pl_Float)*16); 25 | m[0] = m[4+1] = m[8+2] = m[12+3] = 1.0; 26 | m[0+3] = x; m[4+3] = y; m[8+3] = z; 27 | } 28 | 29 | void plMatrixMultiply(pl_Float *dest, pl_Float src[]) { 30 | pl_Float temp[16]; 31 | pl_uInt i; 32 | memcpy(temp,dest,sizeof(pl_Float)*16); 33 | for (i = 0; i < 16; i += 4) { 34 | *dest++ = src[i+0]*temp[(0<<2)+0]+src[i+1]*temp[(1<<2)+0]+ 35 | src[i+2]*temp[(2<<2)+0]+src[i+3]*temp[(3<<2)+0]; 36 | *dest++ = src[i+0]*temp[(0<<2)+1]+src[i+1]*temp[(1<<2)+1]+ 37 | src[i+2]*temp[(2<<2)+1]+src[i+3]*temp[(3<<2)+1]; 38 | *dest++ = src[i+0]*temp[(0<<2)+2]+src[i+1]*temp[(1<<2)+2]+ 39 | src[i+2]*temp[(2<<2)+2]+src[i+3]*temp[(3<<2)+2]; 40 | *dest++ = src[i+0]*temp[(0<<2)+3]+src[i+1]*temp[(1<<2)+3]+ 41 | src[i+2]*temp[(2<<2)+3]+src[i+3]*temp[(3<<2)+3]; 42 | } 43 | } 44 | 45 | void plMatrixApply(pl_Float *m, pl_Float x, pl_Float y, pl_Float z, 46 | pl_Float *outx, pl_Float *outy, pl_Float *outz) { 47 | *outx = x*m[0] + y*m[1] + z*m[2] + m[3]; 48 | *outy = x*m[4] + y*m[5] + z*m[6] + m[7]; 49 | *outz = x*m[8] + y*m[9] + z*m[10] + m[11]; 50 | } 51 | 52 | pl_Float plDotProduct(pl_Float x1, pl_Float y1, pl_Float z1, 53 | pl_Float x2, pl_Float y2, pl_Float z2) { 54 | return ((x1*x2)+(y1*y2)+(z1*z2)); 55 | } 56 | 57 | void plNormalizeVector(pl_Float *x, pl_Float *y, pl_Float *z) { 58 | double length; 59 | length = (*x)*(*x)+(*y)*(*y)+(*z)*(*z); 60 | if (length > 0.0000000001) { 61 | pl_Float t = (pl_Float)sqrt(length); 62 | *x /= t; 63 | *y /= t; 64 | *z /= t; 65 | } else *x = *y = *z = 0.0; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /WDL/plush2/pl_read_jaw.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Plush Version 1.2 3 | read_jaw.c 4 | Jaw3D Object Reader 5 | Copyright (c) 1996-2000, Justin Frankel 6 | ******************************************************************************* 7 | Notes on .JAW files: 8 | This is a file format created by Jawed Karim for Jaw3D 9 | (http://jaw3d.home.ml.org). 10 | -- updated 11/6/00 - www.jawed.com 11 | It is very simple, and lets one easily create ones own models using only 12 | a text editor. The format is pretty simple: 13 | The first line must be "Light: (x,y,z)" where x,y, and z are the x y and 14 | z components of the lightsource vector (I think ;) 15 | A series of lines, numbered 0 to n, in the format of 16 | "i: x y z", where i is the vertex number (which should be listed in 17 | order, and x y and z are the coordinates of that vertex. 18 | A series of lines, having the format "tri a, b, c" where a b and c are 19 | the vertices that the face uses. It is unclear at this time which 20 | way the vertices are listed (ccw or cw), so just make em consistent 21 | and you can always use plFlipObjectNormals() on the loaded object. 22 | That is it! (I told ya it was simple). 23 | ******************************************************************************/ 24 | 25 | #include "plush.h" 26 | 27 | pl_Obj *plReadJAWObj(char *filename, pl_Mat *m) { 28 | FILE *jawfile; 29 | pl_Obj *obj; 30 | pl_uInt32 i; 31 | pl_sInt crap; 32 | char line[256]; 33 | pl_uInt32 total_points = 0, total_polys = 0; 34 | if ((jawfile = fopen(filename, "r")) == NULL) return 0; 35 | fgets(line, 256, jawfile); /* Ignores lightsource info */ 36 | while (fgets(line, 256, jawfile) != NULL) 37 | if (strstr(line, ":") != NULL) total_points++; 38 | 39 | rewind(jawfile); fgets(line, 256, jawfile); 40 | while (fgets(line, 256, jawfile) != NULL) 41 | if (strstr(line, "tri") != NULL) total_polys++; 42 | 43 | rewind(jawfile); fgets(line, 256, jawfile); 44 | obj = new pl_Obj(total_points,total_polys); 45 | 46 | i = 0; 47 | while (fgets(line, 256, jawfile) != NULL) if (strstr(line, ":") != NULL) { 48 | float x, y, z; 49 | sscanf(line, "%d: %f %f %f",&crap,&x,&y,&z); 50 | obj->Vertices.Get()[i].x = (pl_Float) x; 51 | obj->Vertices.Get()[i].y = (pl_Float) y; 52 | obj->Vertices.Get()[i].z = (pl_Float) z; 53 | i++; 54 | } 55 | rewind(jawfile); fgets(line, 256, jawfile); 56 | i = 0; 57 | while (fgets(line, 256, jawfile) != NULL) if (strstr(line, "tri") != NULL) { 58 | pl_uInt32 a,b,c; 59 | sscanf(line, "tri %ld, %ld, %ld", &a, &b, &c); 60 | obj->Faces.Get()[i].VertexIndices[0] = a; 61 | obj->Faces.Get()[i].VertexIndices[1] = c; 62 | obj->Faces.Get()[i].VertexIndices[2] = b; 63 | obj->Faces.Get()[i].Material = m; 64 | i++; 65 | } 66 | fclose(jawfile); 67 | obj->CalculateNormals(); 68 | return obj; 69 | } 70 | -------------------------------------------------------------------------------- /WDL/plush2/pl_spline.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Plush Version 1.2 3 | spline.c 4 | n-th Dimensional Spline Interpolator 5 | Copyright (c) 1996-2000, Justin Frankel 6 | ******************************************************************************/ 7 | 8 | #include "plush.h" 9 | 10 | void pl_Spline::GetPoint(pl_Float frame, pl_Float *out) { 11 | pl_sInt32 i, i_1, i0, i1, i2; 12 | pl_Float time1,time2,time3; 13 | pl_Float t1,t2,t3,t4,u1,u2,u3,u4,v1,v2,v3; 14 | pl_Float a,b,c,d; 15 | 16 | int numKeys=keys.GetSize(); 17 | pl_Float *keyptrs = keys.Get(); 18 | 19 | a = (1-tens)*(1+cont)*(1+bias); 20 | b = (1-tens)*(1-cont)*(1-bias); 21 | c = (1-tens)*(1-cont)*(1+bias); 22 | d = (1-tens)*(1+cont)*(1-bias); 23 | v1 = t1 = -a / 2.0; u1 = a; 24 | u2 = (-6-2*a+2*b+c)/2.0; v2 = (a-b)/2.0; t2 = (4+a-b-c) / 2.0; 25 | t3 = (-4+b+c-d) / 2.0; 26 | u3 = (6-2*b-c+d)/2.0; 27 | v3 = b/2.0; 28 | t4 = d/2.0; u4 = -t4; 29 | 30 | i0 = (pl_uInt) frame; 31 | i_1 = i0 - 1; 32 | while (i_1 < 0) i_1 += numKeys; 33 | i1 = i0 + 1; 34 | while (i1 >= numKeys) i1 -= numKeys; 35 | i2 = i0 + 2; 36 | while (i2 >= numKeys) i2 -= numKeys; 37 | time1 = frame - (pl_Float) ((pl_uInt) frame); 38 | time2 = time1*time1; 39 | time3 = time2*time1; 40 | i0 *= keyWidth; 41 | i1 *= keyWidth; 42 | i2 *= keyWidth; 43 | i_1 *= keyWidth; 44 | for (i = 0; i < keyWidth; i ++) { 45 | a = t1*keyptrs[i+i_1]+t2*keyptrs[i+i0]+t3*keyptrs[i+i1]+t4*keyptrs[i+i2]; 46 | b = u1*keyptrs[i+i_1]+u2*keyptrs[i+i0]+u3*keyptrs[i+i1]+u4*keyptrs[i+i2]; 47 | c = v1*keyptrs[i+i_1]+v2*keyptrs[i+i0]+v3*keyptrs[i+i1]; 48 | *out++ = a*time3 + b*time2 + c*time1 + keyptrs[i+i0]; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /WDL/reminder.h: -------------------------------------------------------------------------------- 1 | #ifndef REMINDER 2 | 3 | #define MAKE_QUOTE(str) #str 4 | #define MAKE_STR(str) MAKE_QUOTE(str) 5 | #if defined WIN32 6 | // This enables: #pragma REMINDER("change this line!") with click-through from VC++. 7 | #define REMINDER(msg) message(__FILE__ "(" MAKE_STR(__LINE__) "): " msg) 8 | #else 9 | #define REMINDER(msg) // no-op 10 | #endif 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /WDL/rfb_client.h: -------------------------------------------------------------------------------- 1 | #ifndef _WDL_RFBCLIENT_H_ 2 | #define _WDL_RFBCLIENT_H_ 3 | 4 | #include "wdlstring.h" 5 | #include "queue.h" 6 | #include "jnetlib/jnetlib.h" 7 | #include "lice/lice.h" 8 | 9 | class WDL_RFB_Client 10 | { 11 | public: 12 | WDL_RFB_Client(JNL_IConnection *con, const char *password); 13 | ~WDL_RFB_Client(); 14 | 15 | int GetScreenWidth() { return m_screen_w; } 16 | int GetScreenHeight() { return m_screen_h; } 17 | 18 | int Run(); // <0 on disconnect, 19 | const char *GetError() { return m_errstr; } 20 | 21 | void Invalidate() { m_needref=2; } // tell server to re-send 22 | void SetUpdateRegion(int x, int y, int w, int h) // if w or h are 0 then whole screen is used 23 | { 24 | m_req_x=x; 25 | m_req_y=y; 26 | m_req_w=w; 27 | m_req_h=h; 28 | 29 | } 30 | void RequestUpdate() { m_needref|=1; } 31 | 32 | void *instance_data; 33 | void (*DrawRectangleCallback)(WDL_RFB_Client *_this, LICE_IBitmap *drawimg, int dest_x, int dest_y, int dest_w, int dest_h); 34 | 35 | 36 | private: 37 | 38 | enum { ErrorState=-1, InitialState=0, AuthWaitState, AuthWaitState2, ServerInitState, RunState, RunState_GettingRects}; 39 | 40 | int m_remote_ver; // xxxyyy 41 | 42 | int m_state; 43 | time_t m_lastt; 44 | const char *m_errstr; 45 | 46 | WDL_String m_password; 47 | JNL_IConnection *m_con; 48 | 49 | int m_screen_w, m_screen_h; 50 | 51 | int m_req_x,m_req_y,m_req_w,m_req_h, m_needref; 52 | 53 | WDL_TypedBuf m_namebuf; 54 | WDL_TypedQueue m_msg_buf; 55 | 56 | int m_skipdata; 57 | 58 | int m_msg_state; // state specific value / data 59 | 60 | unsigned int GetBE(int nb=4, int queueoffs=0, bool advance=true); 61 | 62 | LICE_MemBitmap m_bm; 63 | 64 | char tmperrbuf[128]; 65 | }; 66 | 67 | 68 | 69 | 70 | #endif//_WDL_RFBCLIENT_H_ -------------------------------------------------------------------------------- /WDL/rng.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - rng.cpp 3 | Copyright (C) 2005 and later, Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | */ 22 | 23 | /* 24 | 25 | This file provides the implementation of a decent random number generator, 26 | that internally uses a 256-bit state, and SHA-1 to iterate. 27 | 28 | */ 29 | 30 | #ifdef _WIN32 31 | #include 32 | #else 33 | #include 34 | #include 35 | #include 36 | #endif 37 | 38 | 39 | #include "rng.h" 40 | #include "sha.h" 41 | 42 | static unsigned char state[32]; 43 | 44 | void WDL_RNG_addentropy(void *buf, int buflen) 45 | { 46 | WDL_SHA1 tmp; 47 | tmp.add(state,sizeof(state)); 48 | tmp.result(state); 49 | tmp.reset(); 50 | tmp.add((unsigned char *)buf,buflen); 51 | tmp.result(state+sizeof(state) - WDL_SHA1SIZE); 52 | } 53 | 54 | static void rngcycle() 55 | { 56 | int i; 57 | for (i = 0; i < (int)sizeof(state) && state[i]++; i++); 58 | } 59 | 60 | int WDL_RNG_int32() 61 | { 62 | WDL_SHA1 tmp; 63 | tmp.add(state,sizeof(state)); 64 | rngcycle(); 65 | union { 66 | char buf[WDL_SHA1SIZE]; 67 | int a; 68 | } b; 69 | tmp.result(b.buf); 70 | return b.a; 71 | 72 | } 73 | 74 | 75 | void WDL_RNG_bytes(void *buf, int buflen) 76 | { 77 | char *b=(char *)buf; 78 | while (buflen > 0) 79 | { 80 | char tb[WDL_SHA1SIZE]; 81 | WDL_SHA1 tmp; 82 | tmp.add(state,sizeof(state)); 83 | rngcycle(); 84 | 85 | tmp.result(tb); 86 | const int l=buflen < WDL_SHA1SIZE ? buflen : WDL_SHA1SIZE; 87 | memcpy(b,tb,l); 88 | buflen-=l; 89 | b+=l; 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /WDL/rng.h: -------------------------------------------------------------------------------- 1 | /* 2 | WDL - rng.h 3 | Copyright (C) 2005 and later, Cockos Incorporated 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | */ 22 | 23 | /* 24 | 25 | This header provides the interface to a decent random number generator, 26 | that internally uses a 256-bit state, and SHA-1 to iterate. We wouldn't consider 27 | this RNG to be cryptographically secure, but it may be decent. 28 | 29 | */ 30 | 31 | #ifndef _WDL_RNG_H_ 32 | #define _WDL_RNG_H_ 33 | 34 | 35 | void WDL_RNG_addentropy(void *buf, int buflen); // add entropy to the RNG 36 | 37 | int WDL_RNG_int32(); // get a random integer 38 | void WDL_RNG_bytes(void *buf, int buflen); // get a random string of bytes 39 | 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /WDL/sc_bounce/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | stream 4 | 44 | 45 | 46 |
...loading...
47 |
48 |