text:
Debriders - Mesalt®
Mesalt® supports the cleansing of moderately to heavily discharging wounds including infected wounds
Download Product Sheet
Absorbs exudate, bacteria and necrotic material
Effectively supports the cleansing of the wounds
Easy application
Areas of use Mesalt is intended for the management of heavily discharging and discharging infected wounds in the inflammatory phase and deep cavity wounds such as pressure sores and surgical wounds. Please note that Mesalt is not to be used on low exuding wounds. How Mesalt works The discharge from the wound releases the sodium chloride from the dressing. Mesalt effectively stimulates the cleansing of wounds in the inflammatory phase by absorbing exudate, bacteria and necrotic material from the wound, thereby facilitating the natural wound healing process. Design Mesalt is made of an absorbent, viscose/polyester non woven impregnated with sodium chloride.
Description (size cm)
A gentle, yet effective wound contact layer with Safetac. The open perforated...
An all-in-one foam dressing proven to minimise patient pain and wound trauma...
Mepilex® Border Flex is an all-in-one foam dressing designed for challenging...
Mextra® Superabsorbent's unique 4 layer construction (see image) works...
Melgisorb® Plus is a soft, sterile Calcium Sodium Alginate dressing that absorbs exudate and quickly turns into a gel to provide a moist environment...
A sterile, nonwoven fibre dressing designed to be used on a wide range of highly exuding wounds, including leg and foot ulcers,...
Mölnlycke Health Care LimitedUnity HouseMedlock StreetOldhamLancashireOL1 3HS
Tel: +44 (0) 161 621 3900
© 2018 Mölnlycke Health Care
ATTENTION: Products shown may not be available in all countries. Indication claims may vary from country to country. For market specific product information, see the appropriate location section to this website.
Mölnlycke Health Care is a world-leading provider of single-use surgical and wound care products for customers, healthcare professionals and patients.
The content on this website is intended for healthcare professionals.
The information on the page you are about to enter is intended for healthcare professionals only. To enter our product section, please tick the box below and click "continue".
By ticking the box you confirm that you are a healthcare professional.
Yes, I am a healthcare professional


text:
Sencha Touch features a novel theming system built on top of SASS & Compass. This session will show you how to quickly customize the look and feel of your application, extend core styles, and optimize your stylesheets to download faster. Lot of code samples and walkthroughs included.
Presented by David Kaneda.
Check out sencha.com/conference for more session videos.

subset: commoncrawl


text: Warm and practical, the Guardian boots keep feet safe from hot, cold, salt, ice, stones and abrasive surfaces. Perfect for sensitive feet! They also work well in houses with hardwood floors! Stretchy knit cuff keeps snow or gravel out of the boot while the Velcro closure keeps them in place!


text:
Product Description
Accent Stands Green Marble Top Plant Stand 3316 by Coaster
With such a unique material composition, this mini-sized table will be great addition to the vacant spaces in your home. It features a beautiful green marble top with cherry finish base.This square plant stand is a great solution for displaying a plant or flower vase.
The Accent Stands Green Marble Top Plant Stand by Coaster is available in the area from Coaster.
Even your plants and telephones deserve a little attention. The Accent Stands Collection recognizes the importance of displaying your plants and accessories in style and therefore has come up with several options to do so. The collection features accent tables, end tables and console tables that will be perfect for those awkward or vacant spaces in your home. Several different styles are offered, from traditional, contemporary to mission style, you'll be sure to find a style that will closely fit your tastes. A variety of materials also make up the collection, including different colored marbles and solid woods finishes, glass and even metal. The Accent Stands collection is a great option if you are looking for furniture in the area.
- Sku: 3316
- Manufacturer: Coaster
- Dimension:
- Width (side to side): 11.75 W
- Height (bottom to top): 28.5" H
- Depth (front to back): 11.75" D
- Style Elements:
- Style: Traditional
Additional Information
Additional Information
|Free Shipping
|Delivery Type
|Fedex/UPS Drop off Delivery (If bought alone ) without Appointment / For large quantity, LTL Curbside Delivery with appointment
|Delivery Time
|3-4 Weeks
|Coaster Furniture
|Small Parcel
Product Tags
You may also be interested in the following product(s)
Coaster Drawer Side Table With Shelf 702006
Regular Price: $223.20
Now only: $186.00
Coaster Small Brown Snack Table With Burnished Cooper Base 900280
Regular Price: $81.60
Now only: $68.00
Coaster Distressed Oak Snack Table With Black Metal Base 900279
Regular Price: $96.00
Now only: $80.00
Coaster Casual Storage Chairside Table 900991
Regular Price: $174.00
Now only: $145.00
Coaster Round Plant Stand Table With Bottom Shelf 900936
Regular Price: $68.40
Now only: $57.00
Coaster Round Marble Top Plant Stand 900926
Regular Price: $98.40
Now only: $82.00
Coaster Mission Style Square Plant Stand 4040
Regular Price: $139.20
Now only: $116.00
Coaster Chrome Snack Table With Frosted Tempered Glass Top 900250 QLX1
Regular Price: $72.00
Now only: $60.00
Coaster Cappuccino Chairside Table With Lower Shelf 900972
Regular Price: $151.20
Now only: $126.00
Coaster Metal & Glass Side Table With Scroll Magazine Rack 700401
Regular Price: $96.00
Now only: $80.00
Coaster Contemporary Bowed Leg Chairside Table 900994
Regular Price: $116.40
Now only: $97.00
Coaster Casual 1-Drawer 1-Shelf Chairside Table 900992
Regular Price: $170.40
Now only: $142.00
Coaster Round Plant Stand Table 900934
Regular Price: $98.40
Now only: $82.00
Coaster Plant Stand With Bottom Shelf 900937 QLX4
Regular Price: $69.60
Now only: $58.00
Coaster Round Accent Table With Round Glass Table Top 900256 QLX2
Regular Price: $96.00
Now only: $80.00
Coaster Warm Brown Rectangular Chairside Table 900975
Regular Price: $177.60
Now only: $148.00


text:
Hundreds of thousands gathered at the crossroads of the world to witness a crystal ball with more than 30,000 lights descended at midnight. Lady Gaga and Mayor Michael Bloomberg led the crowd in the final-minute countdown of the famed crystal-paneled ball drop.
Many approached the new year with more relief than joy, as people battered by weather disasters, joblessness and economic uncertainty hoped the stroke of midnight would change their fortunes.
"It was a pretty tough year, but God was looking after us and I know 2012 has got to be better," said Kyralee Scott, 16, of Jackson, N.J., whose father spent most of the year out of work.
Some New York revelers, wearing party hats and "2012" glasses, began camping out Saturday morning, even as workers readied bags stuffed with hundreds of balloons and technicians put colored filters on klieg lights. The crowds cheered as workers lit the crystal-paneled ball that drops at midnight Saturday and put it through a test run, 400 feet above the street. The sphere, now decorated with 3,000 Waterford crystal triangles, has been dropping to mark the new year since 1907, long before television made it a U.S. tradition.
In Times Square, hundreds of thousands people were crammed into spectator pens ringed by barricades, enjoying surprisingly warm weather for the Northeast this time of year. The National Weather Service said Saturday it was about 49 degrees in nearby Central Park. That's about 10 degrees warmer than the normal high temperature this time of year.
As the country prepared for the celebration, glum wasn't on the agenda for many, even those who had a sour year.
"We're hoping the next year will be better," said Becky Martin, a former elementary school teacher who drove from Rockford, Ill., to Times Square after spending a fruitless year trying to find a job. "We're starting off optimistic and hoping it lasts."
Many expressed cautious hope that better times were ahead after a year in which Japan was ravaged by an earthquake and tsunami, hurricanes wreaked havoc across the country and a debt crisis devastated Europe's economy.
"Everybody's suffering. That's why it's so beautiful to be here celebrating something with everybody," said Lisa Nicol, 47, of Melbourne, Australia.
For all of the holiday's bittersweet potential, New York City always treats it like a big party - albeit one that now takes place under the watchful eye of a massive security force, including more than 1,500 police officers.
Dick Clark, who suffered a stroke in 2004, put in a few brief appearances mentioning that he has hosted his namesake New Year's Eve celebration for years, but said "tonight, it's better than ever." Clark, looking cheerful but struggling with his speech, introduced a performance by Lady Gaga and also assisted in the countdown. The show, hosted by Ryan Seacrest also featured a performance by Justin Bieber.
The weather was mild for the celebration with evening temperatures still in the 40s That's about 10 degrees warmer than normal.
One reveler from Ecuador says the weather is "amazing."
Ron Martin says he's super-excited to be in the city to mark the beginning of 2012.
The clean-up began as soon as the celebration ended. City Sanitation Department spokesman Keith Mellis says 149 workers converged on Times Square as New Year's Eve celebration ended early Sunday. They used 22 trucks, 24 mechanical sweepers and 37 backpack blowers to clear an estimated 40 to 50 tons of confetti, party hats and other remainders of the revelry.
Mellis says Times Square reopened to traffic at 6 a.m. Sanitation workers are still there tidying up remaining bits debris, such as confetti that is belatedly wafting to the ground from widowsills and rooftops.
Meanwhile, dozens of Occupy Wall Street demonstrators tried to return to Zuccotti Park, the plaza they held for two months before police kicked them out in November. On Saturday night, they were again met by police. (CLICK TO SEE PHOTOS)
Shortly after midnight, the protesters began marching down lower Broadway toward Zuccotti Park. It was the largest such demonstration since the protest movement was evicted from the park where it began. A large police presence was summoned to the march route, including mounted units. Clashes and arrests soon followed. Officials confirmed one police officer had been injured, but remained in stable condition. No official word on how many protesters were arrested.
(The Associated Press contributed to this report.)
Get Eyewitness News Delivered
Facebook | Twitter | Newsletters | Text Alerts


text:
2010 Toyota Tundra - Consumer Review
Build Quality
Reliability Value
Vehicle2010 Toyota Tundra Tundra Grade FFV 4dr Double Cab 4WD SB (5.7L 8cyl 6A)
ReviewWe recently bought a 10' double cab SR5 TRD with the 5.7. LOVE IT! We tow a 4-ATV trailer with it and you honestly don't even know the trailer is behind you. This truck has ridiculous power and I've yet to even floor it. Extremely comfortable for long trips even while towing. You sit up high and have great visibility. Gauges are a little hard to read in certain light. Love the interior though. We are really impressed with this truck, Toyota got it right. Whenever I see an F-150 I think "I could smoke you". Only gets a few miles to gallon less than my old 4Runner - if you want good gas mileage people buy a car, this is a 381hp towing beast!
Best FeaturesPower, power power. Interior design, exterior design, comfort, reliability
Worst FeaturesGauges, nothing really this truck is well designed well built
Are you the author of this review?Update Your Review
on 03/02/12 06:15 AM (PST)
Ha! That is my exact thought too.. When I see an F-150, Silverado, or Sierra I also think "I could smoke you". I have a 2010 5.7L Double cab with AEM Brute Force intake with dual exhaust outtake. My mechanic brother drove it and thought it had a super charger. A friend drove it and thought it had a race car engine. The power and torque of this Tundra are amazing! The first time I drove it, I immediately realized it was the right truck for me. I tow a travel trailer with it up and down mountains all the time with no problem. It has plenty of room for 6 people, great safety features, and automatic/power options. I look forward to the next time I can drive and tow with it. It's fun to drive.Report it
You must be signed in to post a comment.


text:
Police are appealing for witnesses after a hit-and-run incident in Stow on Tuesday.
A silver Mazda car collided with three parked vehicles on the A7 Galashiels Road around 7.45pm. The Mazda left the road and went down a small embankment.
The male driver and female passenger of the Mazda left the scene, making off on foot towards Edinburgh. The man is described as white, medium build and wearing a dark-blue T-shirt and jeans. No-one was hurt. A 29-year-old woman was detained and released pending further enquiries.


text:
- Home
- Nutrition & Supplements
- GU Roctane Ultra Endurance Energy Gel - 15 Serving Pouch - Past Best by Date
Product Description
Past Best by Date:
Sea Salt Chocolate Jun 2017
Blueberry Pomegranate Mar 2017
Introducing our new 15-Serving GU Roctane Energy Gel pouches. We've 'bulked up' our proven Roctane Energy Gels into a larger serving size to give you, our athletes, more ways to fuel during your extreme efforts or long-duration activities. Loose trash and sticky pockets are hard to avoid when you're out on the trail or road for hours and hours. That's why we partnered with Hydrapak to create a custom 5-serving flask and nozzle designed specifically for GU energy gels. Our Flask makes it easy to carry the fuel you need while reducing trail-litter along the way. Less-mess, less-litter, more Roctane Energy Gel!
Do I have to refrigerate unused portions of the 15-serving GU Energy Gel and GU Roctane Energy Gel after I open it?
Nope! There's no need to refrigerate Gels after opening. Store your GU Roctane Energy Gel for up to one-month after you open the 15-Serving pouch. Just store it in a cool and dry place.
Is it hard to get all of the Energy Gel out of the Hydrapak flask?
The customized soft flask has an easy to remove twist-top, which enables easy access for cleaning. For optimal results, wash by hand under warm water with soap and let it dry completely before its next use. Do not wash in a dishwasher.
Is the flask and nozzle hard to use during activity?
The customized high-flow nozzle by Hydrapak makes it easy to dispense your Gel, and the soft flask lets you squeeze as you go to make sure you get every last bit. Bonus! You can twist the nozzle with your mouth, which makes it possible to fuel up with only one hand!
What if I don't need to bring 5-servings of energy Gel? How will I know how much I'm bringing?
Our Hydropak Gel Flasks have convenient markings to help you get the right amount of servings. One serving of GU Roctane Energy Gel is 1.1 oz., which means you can also use a food scale to portion out the exact amount of Gel you need.
Blueberry Pomegranate
INGREDIENTS: Maltodextrin, Water, Fructose, Leucine, Ornithine Alpha-Ketoglutarate (OKG), Sodium Citrate, Valine, Natural Flavors, Potassium Citrate, Calcium Carbonate, Beta-Alanine, Green Tea (Leaf) Extract (Contains Caffeine), Sea Salt, Isoleucine, Gellan Gum, Malic Acid, Citric Acid, Sunflower Oil, Sodium Benzoate (Preservative), Potassium Sorbate (Preservative).
Sea Salt Chocolate
INGREDIENTS: Maltodextrin, Water, Fructose, Organic Cocoa Liquor, Leucine, Sodium Citrate, Ornithine Alpha-Ketoglutarate (OKG), Valine, Sea Salt, Potassium Citrate, Beta-Alanine, Green Tea (Leaf) Extract (Contains Caffeine), Calcium Carbonate, Isoleucine, Calcium Chloride, Sodium Benzoate (Preservative), Potassium Sorbate (Preservative), Natural Flavor, Pectin Powder, Sunflower Oil.


text:
I Succumbed to Stainless Steel. Now What?
My 15 year old refrigerator has finally kicked the bucket. Well....not exactly. I'm one of those people who paid the exorbitant annual extended warranty fees. My ice maker broke 6 times in the last year, so they (Sears) gave me $1500 to spend on a new fridge of my choice. After swearing I'd never get stainless steel, that's exactly what I went out and bought. In the post-Thanksgiving afterglow, I am thinking of buying stock in Windex. Streaks, spots and general greasiness are all I see. Has anyone found a cleaner that resists spotting to start with on stainless steel? I'm sure there are a few hundred of us that could benefit on you trials and errors. Thanks so much!


text:
The California Lounge Set range brings comfort to the outdoors. Its chunky wicker look and generous proportions make it a great maintenance free outdoor lounge set.
Make the most of your garden this summer with this luxurious set of garden lounge furniture, from Dutch designers Allibert.
This wicker-look garden lounge set comes with two large armchairs, a three-seater sofa, a coffee table and cushions to match.
The set is made from high quality UV stabilised resin and has been carefully designed to look and feel just like natural rattan, while offering great all-year-round resilience.
In fact, we're so confident of the sets lasting quality that it comes with a 3-year warranty.
|Lounge Set
|Solid UV stabilised wicker look resin for outdoor use. This set is entirely maintenance free with the exception of the cushions which we recommend you bring inside during harsh weather conditions. Cushions are made from 100% polyester and the covers are removable for cleaning.
Self assembly is required for this item.
|Lounge Chair: L.83 x W.68 x H.72cm
Three Seater Sofa: L.199 x W.68 x H.72cm
Coffee table: L.68 x W.68 x H.35cm
3-10 working days.
|Orders under £50
|Delivery charge £9.99
|Orders £50-£100
|Delivery charge £14.99
|Orders £100-£250
|Delivery charge £29.99
|Orders over £250
|Delivery is FREE
|Optional Assembly
|£39.95 as premium
What is the 2-Person Delivery Service?
Our two person delivery service is FREE for every order over £250 as standard. This includes the following:
Do you deliver abroad?
International deliveries are accepted to the following countries based on a minimum order value of £1000. If you would like us to deliver to one of the following countries please email firstname.lastname@example.com who will happily guide you through the process.
For more information, check out our Delivery and Returns.
Free 3 year guarantee.


text: tag:blogger.com,1999:blog-2959924903705805464.post865741474087129283..comments2012-11-30T07:25:57.998-05:00Comments on Millions of Miles: It is well with my soulMegan Terryhttps://firstname.lastname@example.com:blogger.com,1999:blog-2959924903705805464.post-58173118208311267742010-01-02T21:02:10.058-05:002010-01-02T21:02:10.058-05:00I am so sorry for your loss. He accomplished many...I am so sorry for your loss. He accomplished many great things in his life and he sounds like a wonderful person.Christa email@example.com:blogger.com,1999:blog-2959924903705805464.post-7722265382925197412010-01-01T16:13:23.532-05:002010-01-01T16:13:23.532-05:00What a nice tribute to what sounds like a great ma...What a nice tribute to what sounds like a great man! My thoughts and prayers have been with your family in saying goodbye, for now. I'm sure Myles will feel as though he knows him from the stories you tell.Jameyhttps://email@example.com:blogger.com,1999:blog-2959924903705805464.post-83517396194970752482010-01-01T13:35:51.917-05:002010-01-01T13:35:51.917-05:00He sounds like a wonderful man and I have no doubt...He sounds like a wonderful man and I have no doubt that all who knew him will miss him dearly. How nice to know that while he may no longer be here in body, you still have all the wonderful memories that you will carry with you and share with you children. His memory and legacy will live on.Debbiehttps://email@example.com


text:
#1 Ranked Children's Hospital by U.S. News & World Report
MyPatients provides referring primary care providers with secure access to their patients' information.
Boston Children's has launched the world's 1st program dedicated to offering hand transplants to children who qualify.
Innovation insider is a semi-monthly e-newsletter analyzes innovations at Boston Children's, other academic medical centers and from industry.
Read the latest blog by a Boston Children's doctor, clinician or staff member.
There are many ways you can help children and their families get the care they need.
Learn more about our ranking as the top pediatric hospital here.
The Nutrition Center at Boston Children's Hospital is dedicated to providing infants, children, adolescents and young adults with comprehensive nutrition assessments, a vital part of a fully customized care plan for many conditions. We design balanced diets to help patients manage their condition, grow and develop, and, ultimately, improve their quality of life. Part of the #1 ranked Division of Gastroenterology, Hepatology and Nutrition (U.S. News & World Report), our team of dietitians is considered the best in the country. But what matters most is how our highly personalized care can help make your child feel better and get back to being a kid again.
We offer a robust clinical program. Each of our dietitians—we have over 50—is highly specialized. So whether your child has been diagnosed with a common condition or a rare disease, we have the expertise to help.
Our dietitians and clinicians are also actively involved in research, collaborating with doctors around the world to learn more about even the most rare conditions.
With over 50 highly specialized registered dietitians, the Nutrition Center at Boston Children's has the expertise to help your child manage their condition, no matter how rare.
Finding answers for our patients and their families is why we do what we do. Our incredible team of registered dietitians is dedicated to helping children with common or complex gastrointestinal, liver and nutritional problems. We can help children with inflammable bowel disease, celiac disease, eosinophilic gastrointestinal disorders and short bowel syndrome, to name a few. In addition, we offer several specialized programs, including:
All of this means your child will have access to the most up-to-date and innovative treatments. In other words, whatever is wrong, whatever questions you have, whatever you need to get your child back to being a kid again, you'll find help and answers here at Boston Children's Hospital.
You can find the help and answers you need close to home. We have 5 locations in Massachusetts, each providing the same level of care, by the same staff as our Boston location. At any of these locations, you'll always know your child is getting the best care in the country.
To make an appointment with one of our dietitians for your personalized assessment, please call 617-355-4677.
Boston Children's is so much more than a hospital—it's a community of researchers, clinicians, administrators, support staff, innovators, teachers, patients and families, all working together to make the impossible possible.


text:
Watch tv in your bathroom and feel free to splash around - the television and it's remote control are completely waterproof after all! While you're at it, make sure to talk on the built-in telephone speakerphone or check who's knocking at the front door, disturbing your bath!
"While the average Joe has nothing but magazines to keep him entertained while in the bathroom, other people who have more than enough dough to throw around probably prefer spending that time watching TV in their luxuriously appointed bathrooms. This is where the 10.2†Bathroom TV comes in, featuring waterproof capability (d-uh) that is also found in its remote control."
Implications - Though television is considered a dying form of entertainment in today's webcentric society, there is still an opportunity to offer more new, innovative selling points with televisions.
Waterproof Television Makes A Splash
More Stats +/-
Quirky Tea Flavors
Assistive Investment Apps
Bell-Shaped Glass Light Fixtures
Sustainable Wool Running Shoes
Burger Chain Fashion Collections


text:
Game of Thrones Targaryen Mousepad
The nearly extinct house has risen out of the fire for a fierce comeback. A three headed dragon with the house motto Fire and Blood make up the Targaryen coat of arms on this Game of Thrones Targaryen Mousepad. Let all your coworkers know youre a Targaryen loyalist to the core.
- Additional Details
- Color: multicolored
- Dimensions: 9.25 x 7.75 inches
- Made In: Imported
- Made Of: Polyester


text:
Your message dated Wed, 27 Feb 2013 09:12:25 +0000 with message-id <email@example.com> and subject line Bug#701751: Removed package(s) from unstable has caused the Debian Bug report #678844, regarding libswirl-java-gcj: unowned files after purge (policy 6.8, 10.8): /var/lib/x86_64-linux-gnu/gcj-4.7/classmap.db to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact firstname.lastname@example.com immediately.) -- 678844: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=678844 Debian Bug Tracking System Contact firstname.lastname@example.com with problems
--- Begin Message ---
- To: Debian Bug Tracking System <email@example.com>
- Subject: libswirl-java-gcj: unowned files after purge (policy 6.8, 10.8): /var/lib/x86_64-linux-gnu/gcj-4.7/classmap.db
- From: Andreas Beckmann <email@example.com>
- Date: Sun, 24 Jun 2012 19:05:49 +0200
- Message-id: <firstname.lastname@example.com>Package: libswirl-java-gcj Version: 1.1-2 Severity: important User: firstname.lastname@example.com Usertags: piuparts Hi, during a test with piuparts I noticed your package left unowned files on the system after purge, which is a violation of policy 6.8 (or 10.8): http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-removedetails Filing this as important as having a piuparts clean archive is a release goal since lenny. >From the attached log (scroll to the bottom...): 0m55.6s ERROR: FAIL: Package purging left files on system: /var/lib/x86_64-linux-gnu/ not owned /var/lib/x86_64-linux-gnu/gcj-4.7/ not owned /var/lib/x86_64-linux-gnu/gcj-4.7/classmap.db not owned cheers, Andreas
Attachment: libswirl-java-gcj_1.1-2.log.gz
Description: GNU Zip compressed data
--- End Message ---
--- Begin Message ---
- To: email@example.com,email@example.com,email@example.com,
- Cc: email@example.com, firstname.lastname@example.com
- Subject: Bug#701751: Removed package(s) from unstable
- From: Debian FTP Masters <firstname.lastname@example.com>
- Date: Wed, 27 Feb 2013 09:12:25 +0000
- Message-id: <email@example.com>Version: 1.1-2+rm Dear submitter, as the package libswirl-java has just been removed from the Debian archive unstable we hereby close the associated bug reports. We are sorry that we couldn't deal with your issue properly. For details on the removal, please see http://bugs.debian.org/701751 The version of this package that was in Debian prior to this removal can still be found using http://snapshot.debian.org/. This message was generated automatically; if you believe that there is a problem with it please contact the archive administrators by mailing firstname.lastname@example.com. Debian distribution maintenance software pp. Ansgar Burchardt (the ftpmaster behind the curtain)
--- End Message ---


text:
Having problems with your Digitrex Digital Cameras ?
Please : Need power supply schematic Digitrex GKX
\015 Please : Need power supply schematic for Digitrex GKX 9200. Low output at all times, Low output at all times, unit would not function properly. (I am a retired ellectronic serviceman)\015
Answers :
Nearly all failures of this sort with power supplies are caused by billions of chinese made capacitors that are failing in just about everything .. look at the top of the electrolytic capacitors .. if its bulged up (should be flat) then thats your problem .. low average voltage is what you will get with an open filter ... the chinese somehow obtained the secrets on how to make the caps but didnt get the part about preventing electrolisis within the capacitor ..this produces O2 and H2 gases inside that eventually cause the case to vent or even rupture .. you will see modern computer mother boards bragging about the fact that they use only japan capacitors now ..
Repair Help & Product Troubleshooting for Digitrex Digital Cameras
Tips for a great answer:- Provide details, support with references or personal experience .
- If you need clarification, ask it in the comment box .
- It's 100% free, no registration required.
Suggested Questions/Answers :
Please : Need power supply schematic Digitrex GKX
Nearly all failures of this sort with power supplies are caused by billions of chinese made capacitors that are failing in just about everything .. look at the top of the electrolytic capacitors .. if its bulged up (should be flat) then thats yo ... Digitrex Digital Cameras
I have old Olympus C-840L. After connect battery power 6V and switch ON camera or display electronic then nothing does not started. It seems that problem is in power switching circuit. Battery supply 6V DC is not connected to electronic due to some part is broken. I need schematic of power supply. Please, answer me if you can help me to my e-mail. Thank you.
... Olympus Camedia C-840L Digital Camera
I have a philips observation camera VC86775T and on the back it only has a jack that fits a telephone cord that goes to a 56k modem. but says voltage 16 27v (DC), 1.5w. but there is not a power slot to hook up a power supply. How do I get this thing working? What do I need. Much help needed. Thanks
... Digital Cameras
I have an Avtech AVC783 stand alone DVR. It has a start up fault - when the power is connected it beeps twice per second & relay is clicking too. I suspect a power surge or power management area problem in the circuitry. Power supply is DC12-18V. I would like help on fault identification from tech experienced with DVR's. The repair options please.
... Digital Cameras
No power for the last few days, the power light would go on, but NOTHING else worked. now the power light does not turn on. (new, rechargable batteries). camera has NOT been droped, nor exposed to sand, water, etc. is it something wrong with the circuit? what would the possible cost of repair be?? please help...i need this camera soooo much!
Gee, hang on I'll get my crystal ball out :-)\015\012\015\012I'm afraid it's impossible to say. It could be anything from a dirty battery connection to a full blown power board meltdown. Without having it on the bench it's impossible to say.\015\012\ ... Nikon Coolpix 3100 Digital Camera
I was given a micromark mm23172 colour cctv camera with no instructions i need to know what cables i need and its power supply for installation. Many thanks Carl
... Digital Cameras
I am old. I have forgot how to load my memory chip from my Cannon power shot A95 into my HP computer with Vista on in. Please can you inform me the steps to procede. I think I need to press my computer but can't get anyone of these sites to work? If this costs me please DONOT answer! [email protected]
The best way to download pictures from your camera to your computer involves removing the memory card from the camera and plugging it into a card reader (either built-in to the computer or connected via USB or FireWire). This is likely to be faster t ... Canon PowerShot A610 Digital Camera
While switch on i am getting memory card Power off or Format if i press power off the camera is totaly off other wise if is use format entire memory card data will be lost, please advice what i need to do this.
Use a card reader to download the pics from the card and then format it in the camera. ... Olympus FE-220 Digital Camera
I have the sony DSC-N2, it will not let me take a picture or video. When i put it in these modes, the screen is completely black but says "turn the power off and on again". When i do that it does nothing different. However, i can access my photos and albums. please help, i need my camera!!!!
I have the sony DSC-N2, it will not let me take a picture or video. When i put it in these modes, the screen is completely black but says "turn the power off and on again". When i do that it does nothing different. However, i can ac ... Digital Cameras
Canon SD1100 digital camera is completely dead. Nothing happens when I press the power button. Battery is good. Battery door switch is in good working order. I need to check for bad (blown) fuses on main board but where ? If you are not familiar with this camera and know how to fix it, please don't respond.
... Canon PowerShot SD1100 IS Digital Camera
Polaroid t831 Hello, I have this camera (Polaroid t831) when i press the power button, it turns on normal Avery thing and after 5 seconds it turns off by itself . Please need help. Atish.
... Digital Cameras
When I press the power button to turn the camera on it flashes green once, but the lenses doesn't open or anything. So, tried to charge it and when I plug the charger into the wall it says its already fully charged. PLEASE HELP Do I need a new charger or what?
Hi there try to remove the memory card & formet that & then fix it back on cam then power on. If still not working then , another reason is lens not ready for work. Some how its not able to stable his focus method. That's why its happens. The ... Sanyo VPC-T1060 Digital Camera
Computer help I have a conon power shot s30 camera and Im trying to find out how to hook It up to my computer and down load picture's but every time I plug In the usb cord I get nothing do I need soft ware or some thing can some one help me please.
I have a vista system on my computer disk for power shot s-30 is not compatiable with vista. how can i down load pics? ... Canon PowerShot S30 Digital Camera
I am in need for a camera charger (to charge the camera through power point ).It is samsung camera model no VP-MX10/XSA.Could you please tell me a shop in Brisbane that sells that camera charger .Thanks in advance . Regards Sajjad Abbasi
... Samsung Digital Cameras
When I connect the camera to my computer, the computer does not recognize it and gives me this message:[ cannot detect trust 350fs power [email protected] flash. please ensure that the USB cable is properly connected ]. i need to help me thank you
Use a card reader to download your pics. ... Trust PowerCam 350FS Digital Camera
I'm charging my batteries but the camera will not stay on. As soon as I power it on the lens comes out and goes rigth back in. Please help i need my camera to work again.
How about try different set of new batteries. It is possible, your lense may have mechanical problem. You would have to open the lense, clean it and put back.\015\012\015\012I hope it helps you ... Kodak EASYSHARE M1063 Digital Camera
I need a 5volt power supply for my kodak z760
You need a five volt power supply!, AC or DC? You can buy plug in adapters from places like **** Smiths. Tandys. Good luck. ... Kodak EasyShare Z760 Digital Camera
Power supply i received a digimax s630 last week from a friend without battery and charger.i need an informations about it.
The camera needs for 2 AA batteries.\015\012My recommendation to you is to buy a set of 4 \015\0122500/2700 mAh NiMH Rechargeable AA Batteries with their charger.\015\012\015\012Enjoy your new camera. ... Samsung Digimax S630 Digital Camera
Lost software Hi I have lost the software for my Canon Power Shot A310 everything was working fine with Adobe now it cannot read the camera. I am a foster mum, and need my camera for evidence of abuse for children i have in my care, please help
You can get downloads of the originalk software at this address:\015\012\015\012http://software.canon-europe.com/products/0010048.asp ... Canon PowerShot A310 Digital Camera
Camera was working fine, but suddenly would not turn on. Thought perhaps the battery needed charging, but when camera is put on charger, the camera will not charge. The charger light flashes green when camera dock is plugged into power and also when plugged into computer. Please help! Our vacation photos are in there. Thanks
Well, U prob. got it wet, whatever ur name is. And it prob doesnt work. I just lost my USB cable for it. And i cant download it. But, anyway, u prob broke it. Srry charlie. Hehehe, what if ur name was really charlie. That would be funny. ... Casio EXILIM ZOOM EX-Z850 Digital Camera
I* have a wonderful 300xdigital Panasonia camcorder, but no ac adapter to charger my battery. Its' about 8 yrs.old. I love it & my deceased husband bought it for me.They tell me that the cord is no longer made. the block is but no cord to power it with. Does something sound stange with that?If you could only find me one..#PVL780D battery itself#PV-BP18. Please help me find a adapter for this one, its special. I'm expecting my first Great Grand Child June 3.I need it soon....I have been lookin
Buy a new camcorder... ... Panasonic Digital Cameras
Lens Error When I turn the power button on -it beeps & the green light blinks then it says lens error, restart camera-but It will not restart & the lens is 1/2 way out & will not go back in. please help-need camera Thanks ,Penny
Here's some things that you can do to try to correct it. They only seem to work for less than 50% of the lens errors, but if the camera is out of warranty, they're worth a try:\015\012 ... Canon PowerShot A560 Digital Camera
Lens problem Zoom lens is stuck in ON position, and when I press Power button, screen reads, "Lens error, restart camera" accompanied by strange whirring sound from lens. Please help! On vacation, and photos are needed! Thanks.
The lens needs replacement.\015\012for reparing estimates cost of camera\015\012http://www.advancecamera.com/repair ... Canon PowerShot SD1000 Digital Camera
Battery power? I have had my camera for about a year and I haven't yet used it. Every time I turn it on it says low battery and shuts off. I change batteries, and now it doesnt turn on at all. Do I need a wall charger or something? Please help!! thank you
Hi there, try to repalce a new battery, the battery needs to shack. it may be reparable but try a new one to test if it will work. ty ... Samsung Digimax 240 Digital Camera
Power problem at first, my problem was the error 99 and i waited a couple of months not repairing it and now i have this problem which is when i use my camera it's working fine with no-flash mode and then when i use it again after a while ( say couple of hours) the camera doesnt turn on and i need to charge the battery again!! PS:i have bought my camera before 11 months!! please help.
Per the symptoms that you describe, it seems that one of the two internal printed board circuit parts have a defective component that is draining out the battery current.\015\012\015\012If you have only 11 months with it, I strongly recom ... Canon Rebel XT / EOS 350D Digital Camera


text:
Customer Service available Mon - Fri 9am to 6pm EST
Leslie Ayvazian,
Donna Daley,
Christine Farrell,
Rita Nachtmann,
Ann Sachs
Customer Rating:
(Rate this!)
Full Length Play, Dramatic Comedy
"[A] thoroughly delightful ... whimsical and celebratory look at contemporary motherhood." - Variety
More Information Below:
Minimum Fee: $75 per performance
Optional Music/Media Fee: $25 per performance
Full Length Play
Dramatic Comedy
Time Period - Contemporary
Play w/ Music
Unit Set/Multiple Settings
Contemporary Costumes / Street Clothes
Feminism, Friendship, Parenting/Family
All Female
All of the characters in MAMA DRAMA are in their mid to late thirties.
No Chorus
Optional Performance Tracks Available.
Contact your licensing representative for more information.
Leslie Ayvazian is the author of 8 full-length plays and 7 one act plays, published variously by Samuel French and Dramatist Play Service. Some have been included in annual anthologies of best plays. Nine Armenians won the John Gassner/Outer Critics Circle Award for best new American play, The Roger L. Stevens Award, and second place for the Susan Smith Blackburn Prize. Rosemary and I received an ... view full profile
Christine Farrell is an actress, playwright, and director. She was the originator and co-author of Mama Drama (Cleveland Play House, Ensemble Studio Theatre, Dorset Play House), which is published by Samuel French. Her one-act play The Once Attractive Woman (Ensemble Studio Theatre Marathon, 12 miles West Theater Company) was published by Faber and Faber. For the Love of God, Saint Teresa was ... view full profile
Playwright Rita Nachtmann died in Mesa, Arizona, Oct. 26, 2003, after a long struggle with cancer. Rita's first public acclaim as a playwright was Mama Drama (Samuel French, Inc.), which she co-authored and which premiered at Cleveland Playhouse in 1990. Her play How I Spent My Life's Vacation, published by Dramatic Publishing, was developed at the New Harmony Project in 1993 and won the 1997 PEN ... view full profile
Ann Sachs spent twenty-five years working as a professional actor prior to 1992, when she accepted her husband's request to join him in what is now Sachs Morgan Studio. Studio projects and clients range from Broadway to Hollywood, from Disney to the Kennedy Center, and just about everything in between. A graduate of Carnegie-Mellon's Drama Department, Ann played dozens of leading roles on Broadway ... view full profile
Samuel French, Inc.
235 Park Avenue South
Fifth Floor
New York, NY 10003
Toll Free: (866) 598-8449
Local: (212) 206-8990
Fax: (212) 206-1429


text:
Heater problem
1994 Ford Aerostar 6 cyl All Wheel Drive Automatic 148000 miles
My front and rear heater switches, rear window defroster switch, and turn signals seem to work when they want to. They will work fine until I turn the engine off, then when I start it up, they won't work. They will not work for up to two or three days. Then all of a sudden they will start again. I have checked the fuses and they are fine. Any ideas?
have the same problem?
Thursday, January 22nd, 2009 AT 11:25 PM


text:
Being the European Capital of Culture 2010 this year. Istanbul, the only city in the world that lies on two continents, is a potpourri of cultures and traditions that represents the perfect blend of East and West. Have you visited the wonders of the city? The Blue Mosque, Saint Sophia, the Princes' Islands, the Museum of Modern Art, "Have you been in all markets? Grand Bazaar, Spice Bazaar, flea markets, a So is the best time to go a step further and discover the nightlife of the city. A touch of Mediterranean, a European metropolis, a decadent air, a Istanbul has it all and nightlife has much to offer. Here we present some examples of local bars and really worthwhile. Sooner or later you will end in the famous shopping street where you can participate in rounds of bars. If you want to fill the stomach first on the around you will find various food stalls
Bambiland is an institution, what began as a small food stand has become a famous chain. It is open 24 hours and is popular with locals and tourists. There is also the bar-restaurant in SOA 5.Kat Sokak rump "num 7 (Cigangir) near Taksim Square. This former five-storey building has a rooftop terrace where you can admire beautiful views of the Bosphorus. Lovers of the 80 can go to Baykus Cafe-Bar, Bekar Sokak num 22 (Beyoglu), where it will really good. A pleasant and vodka with juice manzanaa The bar Dulcinea (MEA elika "num Sokak 20) is also a good option as it opens at 04:00 am. It is ideal if you have to get up early to catch the train / plane / boat / as if you have not yet gone to bed.
Those who prefer electronically, please contact Dirty (Erol Dernek num Sokak 11), with a retro style, or Pixie (num Tosbaga Sokak 12) if they want a bit of everything. For live music is the Babylon (num aehbender Sokak 3), known throughout the city for its jazz concerts. At this location there will be different concerts and some festivals, so it is best to buy tickets in advance. For a bit of punk, indie and other styles of guitar-based, Peyote (num Kameriye Sokak 4) is the perfect place. He has been a meeting place for many years and has even been compared by critics with the same style premises in New York and London. It has been shown that in Istanbul there are local so everyone partying other activity may be more to visit this Turkish city. To get the most out and out until your body says enough, it is best to stay somewhere where you can save on accommodation, enjoy good facilities and quality service. Mireia is an independent traveler, before working as HostelBookers writer visited several countries to discover the wonders of their cities and towns. During his stay in Turkey found quality, affordable place to stay.


text:
Similar to a boostfest, this a gathering of Halo players on a fuckin epic scale. At least 3 tvs and xbox360s are required and 10 or more players. Best night possible.
Tock: "Boostapalooza '08 tomorrow at my place."
Hart: "There is a god"
Hart: "There is a god"
by MilliganMan April 20, 2008


text:
This will produce 2 files. The first file, example_wrap.c, contains all of the C code needed to build your Tcl module. The second file contains supporting documentation and may be named example_wrap.doc, example_wrap.html, example_wrap.tex, etc... To build a Tcl extension you will need to compile the example_wrap.c file and link it with the rest of your program (and possibly Tcl itself).swig -tcl example.i
-tcl8 Produce Tcl8.0 native wrappers (use in place of -tcl). -module Set the module name. -namespace Use [incr Tcl] namespaces. -prefix pkg Set a package prefix of `pkg'. This prefix will be attached to each function. -htcl tcl.h Set name of Tcl header file. -htk tk.h Set name of Tk header file. -plugin Generate additional code for the netscape plugin. -noobject Omit object oriented extensions (compatibility with SWIG 1.0)
Many of these options will be described later.
When locating the right header and libraries files, double check to make sure the files are the correct version and form a matching pair. SWIG works with the following Tcl/Tk releases.
Tcl 7.3, Tk 3.6 Tcl 7.4, Tk 4.0 Tcl 7.5, Tk 4.1 Tcl 7.6, Tk 4.2 Tcl 8.0a2, Tk 8.0a2
Do not mix versions. Although the code might compile if you do, it will usually core dump mysteriously. By default, SWIG looks for the header files "tcl.h" and "tk.h", but your installed version of Tcl/Tk may use slightly different names such as "tcl7.5.h" and "tk4.1.h". If you need to use different header files, you can use the -htcl and -htk options as in :
If you are installing Tcl/Tk yourself, it is often easier to set up a symbolic links between tcl.h and the header files for the latest installed version. You might also be able to make symbolic links to the correct files in your working directory.swig -tcl -htcl tcl7.5.h -htk tk4.1.h example.i
Unfortunately, the process of building of building shared libraries varies on every single machine. SWIG will try to guess when you run configure, but it isn't always successful. It's always a good idea to read the man pages on the compiler/linker to find out more information.unix > swig -tcl example.i unix > gcc -fpic example_wrap.c example.c -I/usr/local/include unix > gcc -shared example.o example_wrap.o -o example.so # Linux
The first argument is the name of the shared library while the second argument is the name of the module (the same as what you specified with the %module directive). As alternative, you can turn your module into a Tcl package. See the section on configuration management at the end of this chapter for details.load ./example.so example
%module mymodule ... declarations ... %include tclsh.i // Support code for rebuilding tclsh
To rebuild tclsh, you will need to compile as follows :
Alternatively, you can use SWIG's -l option to add the tclsh.i library file without modifying the interface file. For example :unix > swig -tcl example.i unix > gcc example_wrap.c example.c -I/usr/local/include -L/usr/local/lib -ltcl -ldl \ -lm -o my_tclsh
The -ldl option will be required if your Tcl/Tk supports dynamic loading. On some machines (most notably Solaris),it will also be necessary to add -lsocket -lnsl to the compile line. This will produce a new version of tclsh that is identical to the old one, but with your extensions added.unix > swig -tcl -ltclsh.i example.i unix > gcc example_wrap.c example.c -I/usr/local/include -L/usr/local/lib -ltcl -ldl \ -lm -o my_tclsh
If you are using Tk, you will want to rebuild the wish executable instead. This can be done as follows :
The compilation process is similar as before, but now looks like this :%module mymodule ... declarations ... %include wish.i // Support code for rebuilding wish
In this case you will end up with a new version of the wish executable with your extensions added. Make sure you include -ltk, -ltcl, and -lX11 in the order shown.unix > swig -tcl example.i unix > gcc example_wrap.c example.c -I/usr/local/include -L/usr/local/lib -ltk -ltcl \ -lX11 -ldl -lm -o my_wish
If you have a function "bar" in the SWIG file, the prefix option will append the prefix to the name when creating a command and call it "Foo_bar".swig -tcl -prefix Foo example.i
By default, the name of the namespace will be the same as the module name, but you can override it using the -prefix option.swig -tcl -namespace example.i
When the -namespace option is used, the resulting wrapper code can be compiled under both Tcl and [incr Tcl]. When compiling under Tcl, the namespace will turn into a package prefix such as in Foo_bar. When running under [incr Tcl], it will be something like Foo::bar.
Now, assuming all went well, SWIG will be automatically invoked when you build your project. Any changes made to the interface file will result in SWIG being automatically invoked to produce a new version of the wrapper file. To run your new Tcl extension, simply run tclsh or wish and use the load command. For example :
MSDOS > tclsh80 % load example.dll % fact 4 24 %
To build the extension, run NMAKE (you may need to run vcvars32 first). This is a pretty minimal Makefile, but hopefully its enough to get you started. With a little practice, you'll be making lots of Tcl extensions.# Makefile for building various SWIG generated extensions SRCS = example.c IFILE = example INTERFACE = $(IFILE).i WRAPFILE = $(IFILE)_wrap.c # Location of the Visual C++ tools (32 bit assumed) TOOLS = c:\msdev TARGET = example.dll CC = $(TOOLS)\bin\cl.exe LINK = $(TOOLS)\bin\link.exe INCLUDE32 = -I$(TOOLS)\include MACHINE = IX86 # C Library needed to build a DLL DLLIBC = msvcrt.lib oldnames.lib # Windows libraries that are apparently needed WINLIB = kernel32.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib # Libraries common to all DLLs LIBS = $(DLLIBC) $(WINLIB) # Linker options LOPT = -debug:full -debugtype:cv /NODEFAULTLIB /RELEASE /NOLOGO / MACHINE:$(MACHINE) -entry:_DllMainCRTStartup@12 -dll # C compiler flags CFLAGS = /Z7 /Od /c /nologo TCL_INCLUDES = -Id:\tcl8.0a2\generic -Id:\tcl8.0a2\win TCLLIB = d:\tcl8.0a2\win\tcl80.lib tcl:: ..\..\swig -tcl -o $(WRAPFILE) $(INTERFACE) $(CC) $(CFLAGS) $(TCL_INCLUDES) $(SRCS) $(WRAPFILE) set LIB=$(TOOLS)\lib $(LINK) $(LOPT) -out:example.dll $(LIBS) $(TCLLIB) example.obj example_wrap.obj
Will be used in Tcl like this :%module example int foo(int a); double bar (double, double b = 3.0); ...
There isn't much more to say...this is pretty straightforward.set a [foo 2] set b [bar 3.5 -1.5] set b [bar 3.5] # Note : default argument is used
When used in an interface file and script, it will operate as follows :int, unsigned int, double, char *,
For all other C datatypes, SWIG will generate a pair of set/get functions. For example :// example.i %module example ... double My_variable; ... # Tcl script puts $My_variable # Output value of C global variable set My_variable 5.5 # Change the value
// example.i short My_short;
will be accessed in Tcl as follows :
While not the most elegant solution, this is the only solution for now. Tcl's normal variable linking mechanism operates directly on a variables and would not work correctly on datatypes other than the 3 basic datatypes supported by Tcl (int, double, and char *).puts [My_short_get] # Get value of global variable My_short_set 5.5 # Set value of global variable
A NULL pointer is represented by the string "NULL". NULL pointers can also be explicitly created as follows :_100f8e2_Vector_p
In Tcl 8.0, pointers are represented using a new type of Tcl object, but the string representation is the same (and is interchangable). As a general, direct manipulation of pointer values is discouraged._0_Vector_p
gets mapped into the following collection of C functions :struct Vector { double x,y,z; };
These functions are then used in the resulting Tcl interface. For example :double Vector_x_get(Vector *obj) double Vector_x_set(Vector *obj, double x) double Vector_y_get(Vector *obj) double Vector_y_set(Vector *obj, double y) double Vector_z_get(Vector *obj) double Vector_z_set(Vector *obj, double z)
# v is a Vector that got created somehow % Vector_x_get $v 3.5 % Vector_x_set $v 7.8 # Change x component
Similar access is provided for unions and the data members of C++ classes.
class List { public: List(); ~List(); int search(char *item); void insert(char *item); void remove(char *item); char *get(int n); int length; static void print(List *l); };
When wrapped by SWIG, the following functions are created :
Within Tcl, we can use the functions as follows :List *new_List(); void delete_List(List *l); int List_search(List *l, char *item); void List_insert(List *l, char *item); void List_remove(List *l, char *item); char *List_get(List *l, int n); int List_length_get(List *l); int List_length_set(List *l, int n); void List_print(List *l);
C++ objects are really just pointers (which are represented as strings). Member functions and data are accessed by simply passing a pointer into a collection of accessor functions that take the pointer as the first argument.% set l [new_List] % List_insert $l Ale % List_insert $l Stout % List_insert $l Lager % List_print $l Lager Stout Ale % puts [List_length_get $l] 3 % puts $l _1008560_List_p %
While somewhat primitive, the low-level SWIG interface provides direct and flexible access to almost any C++ object. As it turns out, it is possible to do some rather amazing things with this interface as will be shown in some of the later examples. SWIG 1.1 also generates an object oriented interface that can be used in addition to the basic interface just described here.
Using the object oriented interface requires no additional modifications or recompilation of the SWIG module (the functions are just used differently).class List { public: List(); ~List(); int search(char *item); void insert(char *item); void remove(char *item); char *get(int n); int length; static void print(List *l); };
MyObject o # Creates a new object `o' MyObject o -this $objptr # Turn a pointer to an existing C++ object into a # Tcl object `o' MyObject -this $objptr # Turn the pointer $objptr into a Tcl "object" MyObject -args args # Create a new object and pick a name for it. A handle # will be returned and is the same as the pointer value. MyObject # The same as MyObject -args, but for constructors that # take no arguments.
Thus, for our List class, we can create new List objects as follows :
List l # Create a new list l set listptr [new_List] # Create a new List using low level interface List l2 -this $listptr # Turn it into a List object named `l2' set l3 [List] # Create a new list. The name of the list is in $l3 List -this $listptr # Turn $listptr into a Tcl object of the same name
Now assuming you're not completely confused at this point, the best way to think of this is that there are really two different ways of representing an object. One approach is to simply use the pointer value as the name of an object. For example :
The second approach is to allow you to pick a name for an object such as "foo". The different types of constructors are really just mechanism for using either approach._100e8f8_List_p
Or if you let SWIG generate the name of the object... (this is the pointer model)% List l % l insert "Bob" % l insert "Mary" % l search "Dave" 0 % ...
% set l [List] % $l insert "Bob" # Note $l contains the name of the object % $l insert "Mary" % $l search "Dave" 0 %
SWIG will automatically call the corresponding C/C++ destructor, with one caveat--SWIG will not destroy an object if you created it from an already existing pointer (if you called the constructor using the -this option). Since the pointer already existed when you created the Tcl object, Tcl doesn't own the object so it would probably be a bad idea to destroy it.% rename l "" # Destroy list object `l'
The cget method currently only allows retrieval of one member at a time. Extracting multiple members will require repeated calls.% l cget -length # Get the length of the list 13
The member -this contains the pointer to the object that is compatible with other SWIG functions. Thus, the following call would be legal
% List l # Create a new list object % l insert Mike % List_print [l cget -this] # Print it out using low-level function
In a structure such as the following :% l configure -length 10 # Change length to 10 (probably not a good idea, but # possible).
you can change the value of all or some of the members as follows :struct Vector { double x, y, z; };
% v configure -x 3.5 -y 2 -z -1.0
The order of attributes does not matter.
Here is a script that illustrates how these things work :
# Example 1 : Using a named object List l # Create a new list l insert Dave # Call some methods l insert Jane l insert Pat List_print [l cget -this] # Call a static method (which requires the pointer value) # Example 2: Let SWIG pick a name set l [List] # Create a new list $l insert Dave # Call some methods $l insert Jane $l insert Pat List_print $l # Call static method (name of object is same as pointer) # Example 3: Already existing object set l [new_List] # Create a raw object using low-level interface List_insert $l Dave # Call some methods (using low-level functions) List -this $l # Turn it into a Tcl object instead $l insert Jane $l insert Part List_print $l # Call static method (uses pointer value as before).
To disable the object oriented interface, run SWIG with the -noobject option. This will strip out all of the extra code and produce only the low-level interface.
/* tree.h */ typedef struct Node Node; struct Node { char *key; char *value; Node *left; Node *right; }; typedef struct Tree { Node *head; /* Starting node */ Node *z; /* Ending node (at leaves) */ } Tree; extern Node *new_Node(char *key, char *value); extern Tree *new_Tree();
The C functions to create new nodes and trees are as follows :
/* File : tree.c */ #include <string.h> #include "tree.h" Node *new_Node(char *key, char *value) { Node *n; n = (Node *) malloc(sizeof(Node)); n->key = (char *) malloc(strlen(key)+1); n->value = (char *) malloc(strlen(value)+1); strcpy(n->key,key); strcpy(n->value,value); n->left = 0; n->right = 0; return n; }; Tree *new_Tree() { Tree *t; t = (Tree *) malloc(sizeof(Tree)); t->head = new_Node("","__head__"); t->z = new_Node("__end__","__end__"); t->head->right = t->z; t->z->left = t->z; t->z->right = t->z; return t; }
To build the module, run SWIG as follows and compile the resulting output :// file : tree.i %module tree %{ #include "tree.h" %} %include tree.h // Just grab header file since it's fairly simple
% swig -tcl -ltclsh.i tree.i % gcc tree.c tree_wrap.c -I/usr/local/include -L/usr/local/lib -ltcl -lm -o my_tclsh
We can now try out the module interactively by just running the new `my_tclsh' executable.
unix > my_tclsh % set t [new_Tree] # Create a new tree _8053198_Tree_p % set n [Tree_head_get $t] # Get first node _80531a8_Node_p % puts [Node_value_get $n] # Get its value __head__ % Node -this $n % $n cget -value # Altenative method for getting value __head__
While written in Tcl, these functions are building up a real C binary tree data structure that could be passed into other C function. For example, we could write a function that globs an entire directory and builds a tree structure as follows :# Insert an item into a tree proc insert_tree {tree key value} { set tree_head [Tree_head_get $tree] set tree_z [Tree_z_get $tree] set p $tree_head set x [Node_right_get $tree_head] while {[Node_key_get $x] != "__end__"} { set p $x if {$key < [Node_key_get $x]} { set x [Node_left_get $x] } { set x [Node_right_get $x] } } set x [new_Node $key $value] if {$key < [Node_key_get $p]} { Node_left_set $p $x } { Node_right_set $p $x } Node_left_set $x $tree_z Node_right_set $x $tree_z } # Search tree and return all matches proc search_tree {tree key} { set tree_head [Tree_head_get $tree] set tree_z [Tree_z_get $tree] set found {} set x [Node_right_get $tree_head] while {[Node_key_get $x] != "__end__"} { if {[Node_key_get $x] == $key} { lappend found [Node_value_get $x] } if {$key < [Node_key_get $x]} { set x [Node_left_get $x] } { set x [Node_right_get $x] } } return $found }
We can test out our function interactively as follows :# Insert all of the files in pathname into a binary tree proc build_dir_tree {tree pathname} { set error [catch {set filelist [glob -nocomplain $pathname/*]}] if {$error == 0} { foreach f $filelist { if {[file isdirectory $f] == 1} { insert_tree $tree [file tail $f] $f if {[file type $f] != "link"} {build_dir_tree $tree $f} } { insert_tree $tree [file tail $f] $f } } } }
% source tree.tcl % set t [new_Tree] # Create a new tree _80533c8_Tree_p % build_dir_tree $t /home/beazley/SWIG/SWIG1.1 % search_tree $t tcl /home/beazley/SWIG/SWIG1.1/Examples/tcl /home/beazley/SWIG/SWIG1.1/swig_lib/tcl %
To use this function in Tcl, simply put a declaration into the file tree.h or tree.i.void insert_tree(Tree *t, char *key, char *value) { Node *p; Node *x; p = t->head; x = t->head->right; while (x != t->z) { p = x; if (strcmp(key,x->key) < 0) x = x->left; else x = x->right; } x = new_Node(key,value); if (strcmp(key,p->key) < 0) p->left = x; else p->right = x; x->left = t->z; x->right = t->z; }
When reimplemented in C, the underlying Tcl script may not notice the difference. For example, our directory subroutine would not care if insert_tree had been written in Tcl or C. Of course, by writing this function C, we will get significantly better performance.
The %addmethods directive can be used to attach methods to existing structures and classes. In this case, we are attaching some methods to the Tree structure. Each of the methods are simply various C functions we have written for accessing trees. This type of interface file comes in particularly handy when using the Tcl object oriented interface. For example, we can rewrite our directory globber as follows :%module tree %{ #include "tree.h" %} %include tree.h %{ /* Function to count up Nodes */ static int count_nodes(Node *n, Node *end) { if (n == end) return 0; return 1+count_nodes(n->left,end)+count_nodes(n->right,end); } %} // Attach some new methods to the Tree structure %addmethods Tree { void insert(char *key, char *value) { insert_tree(self,key,value); } char *search(char *key) { return search_tree(self,key); } char *findnext(char *key) { return find_next(self,key); } int count() { return count_nodes(self->head->right,self->z); } Tree(); // This is just another name for new_Tree }
Now using it :proc build_dir_tree {tree pathname} { set error [catch {set filelist [glob -nocomplain $pathname/*]}] if {$error == 0} { foreach f $filelist { if {[file isdirectory $f] == 1} { $tree insert [file tail $f] $f # Note new calling method if {[file type $f] != "link"} {build_dir_tree $tree $f} } { $tree insert [file tail $f] $f } } } }
% source tree.tcl % Tree t # Create a new Tree object _8054610_Tree_p % build_dir_tree t /home/beazley/SWIG/SWIG1.1 % t count 1770 % t search glaux.i /home/beazley/SWIG/SWIG1.1/Examples/OpenGL/glaux.i % t search typemaps /home/beazley/SWIG/SWIG1.1/Examples/perl5/typemaps % t findnext typemaps /home/beazley/SWIG/SWIG1.1/Examples/python/typemaps % t findnext typemaps /home/beazley/SWIG/SWIG1.1/Examples/tcl/typemaps % t findnext typemaps None %
With a little extra work, we've managed to turn an ordinary C structure into a class-like object in Tcl.
Suppose that we have a C program for manipulating directed graphs and that we wanted to provide a Tk interface for building graphs using a ball-and-stick model such as the following :
The SWIG interface file for this might look something like this :
The interface file manipulates Node and AdjList structures. The precise implementation of these doesn't matter here--in fact SWIG doesn't even need it. Within a Tcl/Tk script however, we can keep track of these objects as follows :%module graph %{ #include "graph.h" %} /* Get a node's number */ int GetNum(Node *n); /* Get a node's number */ AdjList *GetAdj(Node *n); /* Get a node's adjacency list */ AdjList *GetNext(AdjList *l); /* Get next node in adj. list */ Node *GetNode(AdjList *l); /* Get node from adj. list */ Node *new_node(); /* Make a new node */ void AddLink(Node *v1, Node *v2); /* Add an edge */ ... etc ...
# Make a new node and put it on the canvas proc mkNode {x y} { global nodeX nodeY nodeP nodeMap nodeList edgeFirst edgeSecond set new [.c create oval [expr $x-15] [expr $y-15] \ [expr $x+15] [expr $y+15] -outline black \ -fill white -tags node] set newnode [new_node] ;# Make a new C Node set nnum [GetNum $newnode] ;# Get our node's number set id [.c create text [expr $x-4] [expr $y+10] \ -text $nnum -anchor sw -tags nodeid] set nodeX($new) $x ;# Save coords of canvas item set nodeY($new) $y set nodeP($new) $newnode ;# Save C pointer set nodeMap($newnode) $new ;# Map pointer to Tk widget set edgeFirst($new) {} set edgeSecond($new) {} lappend nodeList $new ;# Keep a list of all C ;# Pointers we've made } # Make a new edge between two nodes and put an arrow on the canvas proc mkEdge {first second new} { global nodeP edgeFirst edgeSecond set edge [mkArrow $first $second] ;# Make an arrow lappend edgeFirst($first) $edge ;# Save information lappend edgeSecond($second) $edge if {$new == 1} { # Now add an edge within our C data structure AddLink $nodeP($first) $nodeP($second) ;# Add link to C structure } }
In these functions, the array nodeP() allows us to associate a particular canvas item with a C object. When manipulating the graph, this makes it easy to move from the Tcl world to C. A second array, nodeMap() allows us to go the other way--mapping C pointers to canvas items. A list nodeList keeps track of all of the nodes we've created just in case we want to examine all of the nodes. For example, suppose a C function added more edges to the graph. To reflect the new state of the graph, we would want to add more edges to the Tk canvas. This might be accomplished as follows :
# Look at the C data structure and update the canvas proc mkEdges {} { global nodeX nodeY nodeP nodeMap nodeList edgeFirst edgeSecond unset edgeFirst unset edgeSecond .c delete arc # Edges have been tagged with arc (not shown) foreach node $nodeList { ;# clear old lists set edgeFirst($node) {} set edgeSecond($node) {} } foreach node $nodeList { ;# Go through all of the nodes set v $nodeP($node) ;# Get the node pointer set v1 [GetAdj $v] ;# Get its adjacency list while {$v1 != "NULL"} { set v2 [GetNode $v1] ;# Get node pointer set w $nodeMap($v2) ;# Get canvas item mkEdge $node $w 0 ;# Make an edge between them set v1 [GetNext $v1] ;# Get next node } } }
This function merely scans through all of the nodes and walks down the adjacency list of each one. The nodeMap() array maps C pointers onto the corresponding canvas items. We use this to construct edges on the canvas using the mkEdge function.
SWIG is quite literal in its interpretation of double *--it is a pointer to a double. To provide access, a few helper functions can be written such as the following :// Add vector a+b -> c void vector_add(double *a, double *b, double *c, int size);
// SWIG helper functions for double arrays %inline %{ double *new_double(int size) { return (double *) malloc(size*sizeof(double)); } void delete_double(double *a) { free a; } double get_double(double *a, int index) { return a[index]; } void set_double(double *a, int index, double val) { a[index] = val; } %}
Using our C functions might work like this :
The functions get_double and set_double can be used to access individual elements of an array. To convert from Tcl lists to C arrays, one could write a few functions in Tcl such as the following :# Tcl code to create some arrays and add them set a [new_double 200] set b [new_double 200] set c [new_double 200] # Fill a and b with some values for {set i 0} {$i < 200} {incr i 1} { set_double $a $i 0.0 set_double $b $i $i } # Add them and store result in c vector_add $a $b $c 200
While not optimal, one could use these to turn a Tcl list into a C representation. The C representation could be used repeatedly in a variety of C functions without having to repeatedly convert from strings (Of course, if the Tcl list changed one would want to update the C version). Likewise, it is relatively simple to go back from C into Tcl. This is not the only way to manage arrays--typemaps can be used as well. The SWIG library file `array.i' also contains a variety of pre-written helper functions for managing different kinds of arrays.# Tcl Procedure to turn a list into a C array proc Tcl2Array {l} { set len [llength $l] set a [new_double $len] set i 0 foreach item $l { set_double $a $i $item incr i 1 } return $a } # Tcl Procedure to turn a C array into a Tcl List proc Array2Tcl {a size} { set l {} for {set i 0} {$i < size} {incr i 1} { lappend $l [get_double $a $i] } return $l }
// gl.i : SWIG file for OpenGL %module gl %{ #include <GL/gl.h> %} ... Rest of edited gl.h file here ...
A critical part of this first step is making sure you have the proper set of typedefs in the gl.i file. The first part of the file should include definitions such as the following :
typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; typedef signed char GLbyte; typedef short GLshort; typedef int GLint; typedef int GLsizei; typedef unsigned char GLubyte; typedef unsigned short GLushort; typedef unsigned int GLuint; typedef float GLfloat; typedef float GLclampf; typedef double GLdouble; typedef double GLclampd; typedef void GLvoid;
Given these two files, we have a fairly complete OpenGL package. Unfortunately, we still don't have any mechanism for opening a GL window and creating images. To to this, we can wrap the OpenGL auxilliary library which contains functions to open windows and draw various kinds of objects (while not the most powerful approach, it is the simplest to implement and works on most machines).%module glu %{ #include <GL/glu.h> %} ... rest of edited glu.h file here ...
// File :glaux.i %module glaux %{ #include "glaux.h" %} ... Rest of edited glaux.h file ...
// help.i : OpenGL helper functions %inline %{ GLfloat *newfv4(GLfloat a,GLfloat b,GLfloat c,GLfloat d) { GLfloat *f; f = (GLfloat *) malloc(4*sizeof(GLfloat)); f[0] = a; f[1] = b; f[2] = c; f[3] = d; return f; } void setfv4(GLfloat *fv, GLfloat a, GLfloat b, GLfloat c, GLfloat d) { fv[0] = a; fv[1] = b; fv[2] = c; fv[3] = d; } %} %name(delfv4) void free(void *);
To build the module, we can simply run SWIG as follows :// // opengl.i. SWIG Interface file for OpenGL %module opengl %include gl.i // The main GL functions %include glu.i // The GLU library %include glaux.i // The aux library %include help.i // Our helper functions
orunix > swig -tcl opengl.i # Build a dynamicly loaded extension
Compile the file opengl_wrap.c with your C compiler and link with Tcl, Tk, and OpenGL to create the final module.unix > swig -tcl -lwish.i opengl.i # Build a statically linked wish executable
load ./opengl.so auxInitDisplayMode [expr {$AUX_SINGLE | $AUX_RGBA | $AUX_DEPTH}] auxInitPosition 0 0 500 500 auxInitWindow "Lit-Sphere" # set up material properties set mat_specular [newfv4 1.0 1.0 1.0 1.0] set mat_shininess [newfv4 50.0 0 0 0] set light_position [newfv4 1.0 1.0 1.0 0.0] glMaterialfv $GL_FRONT $GL_SPECULAR $mat_specular glMaterialfv $GL_FRONT $GL_SHININESS $mat_shininess glLightfv $GL_LIGHT0 $GL_POSITION $light_position glEnable $GL_LIGHTING glEnable $GL_LIGHT0 glDepthFunc $GL_LEQUAL glEnable $GL_DEPTH_TEST # Set up view glClearColor 0 0 0 0 glColor3f 1.0 1.0 1.0 glMatrixMode $GL_PROJECTION glLoadIdentity glOrtho -1 1 -1 1 -1 1 glMatrixMode $GL_MODELVIEW glLoadIdentity # Draw it glClear $GL_COLOR_BUFFER_BIT glClear $GL_DEPTH_BUFFER_BIT auxSolidSphere 0.5 # Clean up delfv4 $mat_specular delfv4 $mat_shininess delfv4 $light_position
In our interpreted interface, it is possible to interactively change parameters and see the effects of various OpenGL functions. This a great way to figure out what various functions do and to try different things without having to recompile and run after each change.
proc clear_screan { } { global GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT glClear $GL_COLOR_BUFFER_BIT glClear $GL_DEPTH_BUFFER_BIT }
glMaterialfv $GL_FRONT $GL_SPECULAR {1.0 1.0 1.0 1.0}
While these are only minor annoyances, it turns out that you can address both problems using SWIG typemaps (which are discussed shortly).
class RangeError {}; // Used for an exception class DoubleArray { private: int n; double *ptr; public: // Create a new array of fixed size DoubleArray(int size) { ptr = new double[size]; n = size; } // Destroy an array ~DoubleArray() { delete ptr; } // Return the length of the array int length() { return n; } // Get an item from the array and perform bounds checking. double getitem(int i) { if ((i >= 0) && (i < n)) return ptr[i]; else throw RangeError(); } // Set an item in the array and perform bounds checking. void setitem(int i, double val) { if ((i >= 0) && (i < n)) ptr[i] = val; else { throw RangeError(); } } };
The functions associated with this class can throw a C++ range exception for an out-of-bounds array access. We can catch this in our Tcl extension by specifying the following in an interface file :
or in Tcl 8.0%except(tcl) { try { $function // Gets substituted by actual function call } catch (RangeError) { interp->result = "Array index out-of-bounds"; return TCL_ERROR; } }
When the C++ class throws a RangeError exception, our wrapper functions will catch it, turn it into a Tcl exception, and allow a graceful death as opposed to just having some sort of mysterious program crash. We are not limited to C++ exception handling. Please see the chapter on exception handling for more details on other possibilities, including a method for language-independent exception handling..%except(tcl8) { try { $function // Gets substituted by actual function call } catch (RangeError) { Tcl_SetStringObj(tcl_result,"Array index out-of-bounds"); return TCL_ERROR; } }
%module example %typemap(tcl,in) int { $target = (int) atoi($source); printf("Received an integer : %d\n",$target); } ... extern int fact(int n);
Typemaps require a language name, method name, datatype, and conversion code. For Tcl, "tcl" should be used as the language name. For Tcl 8.0, "tcl8" should be used if you are using the native object interface. The "in" method in this example refers to an input argument of a function. The datatype `int' tells SWIG that we are remapping integers. The supplied code is used to convert from a Tcl string to the corresponding C datatype. Within the supporting C code, the variable $source contains the source data (a string in this case) and $target contains the destination of a conversion (a C local variable).
When the example is compiled into a Tcl module, it will operate as follows :
% fact 6 Received an integer : 6 720 %
A full discussion of typemaps can be found in the main SWIG users reference. We will primarily be concerned with Tcl typemaps here.
%typemap(tcl,in) Converts a string to input function arguments
%typemap(tcl,out) Converts return value of a C function to a string
%typemap(tcl,freearg) Cleans up a function argument (if necessary)
%typemap(tcl,argout) Output argument processing
%typemap(tcl,ret) Cleanup of function return values
%typemap(tcl,const) Creation of Tcl constants
%typemap(memberin) Setting of C++ member data
%typemap(memberout) Return of C++ member data
%typemap(tcl, check) Check value of function arguments.
$source Source value of a conversion
$target Target of conversion (where the result should be stored)
$type C datatype being remapped
$mangle Mangled version of data (used for pointer type-checking)
$value Value of a constant (const typemap only)
$arg Original function argument (usually a string)
In this example, two typemaps are applied to the char ** datatype. However, the second typemap will only be applied to arguments named `argv'. A named typemap will always override an unnamed typemap.%module foo // This typemap will be applied to all char ** function arguments %typemap(tcl,in) char ** { ... } // This typemap is applied only to char ** arguments named `argv' %typemap(tcl,in) char **argv { ... }
Due to the name-based nature of typemaps, it is important to note that typemaps are independent of typedef declarations. For example :
To get around this problem, the %apply directive can be used as follows :%typemap(tcl, in) double { ... get a double ... } void foo(double); // Uses the above typemap typedef double Real; void bar(Real); // Does not use the above typemap (double != Real)
%typemap(tcl,in) double { ... get a double ... } void foo(double); typedef double Real; // Uses typemap %apply double { Real }; // Applies all "double" typemaps to Real. void bar(Real); // Now uses the same typemap.
When compiled, we can use our functions as follows :%module argv // This tells SWIG to treat char ** as a special case %typemap(tcl,in) char ** { int tempc; if (Tcl_SplitList(interp,$source,&tempc,&$target) == TCL_ERROR) return TCL_ERROR; } // This gives SWIG some cleanup code that will get called after the function call %typemap(tcl,freearg) char ** { free((char *) $source); } // Return a char ** as a Tcl list %typemap(tcl,out) char ** { int i = 0; while ($source[i]) { Tcl_AppendElement(interp,$source[i]); i++; } } // Now a few test functions %inline %{ int print_args(char **argv) { int i = 0; while (argv[i]) { printf("argv[%d] = %s\n", i,argv[i]); i++; } return i; } // Returns a char ** list char **get_args() { static char *values[] = { "Dave", "Mike", "Susan", "John", "Michelle", 0}; return &values[0]; } // A global variable char *args[] = { "123", "54", "-2", "0", "NULL", 0 }; %} %include tclsh.i
% print_args {John Guido Larry} argv[0] = John argv[1] = Guido argv[2] = Larry 3 % puts [get_args] Dave Mike Susan John Michelle % puts [args_get] 123 54 -2 0 NULL %
Perhaps the only tricky part of this example is the implicit memory allocation that is performed by the Tcl_SplitList function. To prevent a memory leak, we can use the SWIG "freearg" typemap to clean up the argument value after the function call is made. In this case, we simply free up the memory that Tcl_SplitList allocated for us.
If you have hundreds of functions however, this quickly gets annoying. Here's a fix using hash tables and SWIG typemaps :proc clearscreen { } { global GL_COLOR_BUFFER_BIT glClear $GL_COLOR_BUFFER_BIT }
In our Tcl code, we can now access constants by name without using the "global" keyword as follows :// Declare some Tcl hash table variables %{ static Tcl_HashTable constTable; /* Hash table */ static int *swigconst; /* Temporary variable */ static Tcl_HashEntry *entryPtr; /* Hash entry */ static int dummy; /* dummy value */ %} // Initialize the hash table (This goes in the initialization function) %init %{ Tcl_InitHashTable(&constTable,TCL_STRING_KEYS); %} // A Typemap for creating constant values // $source = the value of the constant // $target = the name of the constant %typemap(tcl,const) int, unsigned int, long, unsigned long { entryPtr = Tcl_CreateHashEntry(&constTable,"$target",&dummy); swigconst = (int *) malloc(sizeof(int)); *swigconst = $source; Tcl_SetHashValue(entryPtr, swigconst); /* Make it so constants can also be used as variables */ Tcl_LinkVar(interp,"$target", (char *) swigconst, TCL_LINK_INT | TCL_LINK_READ_ONLY); }; // Now change integer handling to look for names in addition to values %typemap(tcl,in) int, unsigned int, long, unsigned long { Tcl_HashEntry *entryPtr; entryPtr = Tcl_FindHashEntry(&constTable,$source); if (entryPtr) { $target = ($type) (*((int *) Tcl_GetHashValue(entryPtr))); } else { $target = ($type) atoi($source); } }
proc clearscreen { } { glClear GL_COLOR_BUFFER_BIT }
When wrapped, SWIG matches the argout typemap to the "double *outvalue" argument. The "ignore" typemap tells SWIG to simply ignore this argument when generating wrapper code. As a result, a Tcl function using these typemaps will work like this :// A typemap defining how to return an argument by appending it to the result %typemap(tcl,argout) double *outvalue { char dtemp[TCL_DOUBLE_SPACE]; Tcl_PrintDouble(interp,*($source),dtemp); Tcl_AppendElement(interp, dtemp); } // A typemap telling SWIG to ignore an argument for input // However, we still need to pass a pointer to the C function %typemap(tcl,ignore) double *outvalue { static double temp; /* A temporary holding place */ $target = &temp; } // Now a function returning two values int mypow(double a, double b, double *outvalue) { if ((a < 0) || (b < 0)) return -1; *outvalue = pow(a,b); return 0; };
% mypow 2 3 # Returns two values, a status value and the result 0 8 %
An alternative approach to this is to return values in a Tcl variable as follows :
Our Tcl script can now do the following :%typemap(tcl,argout) double *outvalue { char temp[TCL_DOUBLE_SPACE]; Tcl_PrintDouble(interp,*($source),dtemp); Tcl_SetVar(interp,$arg,temp,0); } %typemap(tcl,in) double *outvalue { static double temp; $target = &temp; }
Here, we have passed the name of a Tcl variable to our C wrapper function which then places the return value in that variable. This is now very close to the way in which a C function calling this function would work.% set status [mypow 2 3 a] % puts $status 0 % puts $a 8.0 %
By default, SWIG will simply treat all occurrences of "User" as a pointer. Thus, functions like this :typedef struct { char login[16]; /* Login ID */ int uid; /* User ID */ int gid; /* Group ID */ char name[32]; /* User name */ char home[256]; /* Home directory */ } User;
will work, but they will be weird. In fact, they may not work at all unless you write helper functions to create users and extract data. A typemap can be used to fix this problem however. For example :extern void add_user(User u); extern User *lookup_user(char *name);
// This works for both "User" and "User *" %typemap(tcl,in) User * { int tempc; char **tempa; static User temp; if (Tcl_SplitList(interp,$source,&tempc,&tempa) == TCL_ERROR) return TCL_ERROR; if (tempc != 5) { free((char *) tempa); interp->result = "Not a valid User record"; return TCL_ERROR; } /* Split out the different fields */ strncpy(temp.login,tempa[0],16); temp.uid = atoi(tempa[1]); temp.gid = atoi(tempa[2]); strncpy(temp.name,tempa[3],32); strncpy(temp.home,tempa[4],256); $target = &temp; free((char *) tempa); } // Describe how we want to return a user record %typemap(tcl,out) User * { char temp[20]; if ($source) { Tcl_AppendElement(interp,$source->login); sprintf(temp,"%d",$source->uid); Tcl_AppendElement(interp,temp); sprintf(temp,"%d",$source->gid); Tcl_AppendElement(interp,temp); Tcl_AppendElement(interp,$source->name); Tcl_AppendElement(interp,$source->home); } }
These function marshall Tcl lists to and from our User data structure. This allows a more natural implementation that we can use as follows :
This is a much cleaner interface (although at the cost of some performance). The only caution I offer is that the pointer view of the world is pervasive throughout SWIG. Remapping complex datatypes like this will usually work, but every now and then you might find that it breaks. For example, if we needed to manipulate arrays of Users (also mapped as a "User *"), the typemaps defined here would break down and something else would be needed. Changing the representation in this manner may also break the object-oriented interface.% add_user {beazley 500 500 "Dave Beazley" "/home/beazley"} % lookup_user beazley beazley 500 500 {Dave Beazley} /home/beazley
These functions can be used in typemaps as well. For example, the following typemap makes an argument of "char *buffer" accept a pointer instead of a NULL-terminated ASCII string.
Note that the $mangle variable generates the type string associated with the datatype used in the typemap.%typemap(tcl,in) char *buffer { if (SWIG_GetPtr($source, (void **) &$target, "$mangle")) { Tcl_SetResult(interp,"Type error. Not a pointer", TCL_STATIC); return TCL_ERROR; } }
By now you hopefully have the idea that typemaps are a powerful mechanism for building more specialized applications. While writing typemaps can be technical, many have already been written for you. See the SWIG library reference for more information.
While SWIG is certainly not a magical solution to the configuration management problem, it can help out alot in a number of key areas :
While relatively simple to write, there are tons of problems with doing this. First, each extension that you use typically has their own Tcl_AppInit() function. This forces you to write a special one to initialize everything by hand. Secondly, the process of writing a main program and initializing the interpreter varies between different versions of Tcl and different platforms. For example, in Tcl 7.4, the variable "tcl_RcFileName" is a C variable while in Tcl7.5 and newer versions its a Tcl variable instead. Similarly, the Tcl_AppInit function written for a Unix machine might not compile correctly on a Mac or Windows machine./* main.c */ #include <tcl.h> main(int argc, char *argv[]) { Tcl_Main(argc,argv); exit(0); } int Tcl_AppInit(Tcl_Interp *interp) { if (Tcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } /* Initialize your extension */ if (Your_Init(interp) == TCL_ERROR) { return TCL_ERROR; } tcl_RcFileName = "~/.myapp.tcl"; return TCL_OK; }
In SWIG, it is almost never necessary to write a Tcl_AppInit() function because this is now done by SWIG library files such as tclsh.i or wish.i. To give a better idea of what these files do, here's the code from the SWIG tclsh.i file which is roughly comparable to the above code
// tclsh.i : SWIG library file for rebuilding tclsh %{ /* A TCL_AppInit() function that lets you build a new copy * of tclsh. * * The macro SWIG_init contains the name of the initialization * function in the wrapper file. */ #ifndef SWIG_RcFileName char *SWIG_RcFileName = "~/.myapprc"; #endif int Tcl_AppInit(Tcl_Interp *interp){ if (Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR; /* Now initialize our functions */ if (SWIG_init(interp) == TCL_ERROR) return TCL_ERROR; #if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5 Tcl_SetVar(interp,"tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); #else tcl_RcFileName = SWIG_RcFileName; #endif return TCL_OK; } #if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 4 int main(int argc, char **argv) { Tcl_Main(argc, argv, Tcl_AppInit); return(0); } #else extern int main(); #endif %}
This file is essentially the same as a normal Tcl_AppInit() function except that it supports a variety of Tcl versions. When included into an interface file, the symbol SWIG_init contains the actual name of the initialization function (This symbol is defined by SWIG when it creates the wrapper code). Similarly, a startup file can be defined by simply defining the symbol SWIG_RcFileName. Thus, a typical interface file might look like this :
By including the tclsh.i, you automatically get a Tcl_AppInit() function. A variety of library files are also available. wish.i can be used to build a new wish executable, expect.i contains the main program for Expect, and ish.i, itclsh.i, iwish.i, and itkwish.i contain initializations for various incarnations of [incr Tcl].%module graph %{ #include "graph.h" #define SWIG_RcFileName "graph.tcl" %} %include tclsh.i ... declarations ...
// expect.i : SWIG Library file for Expect %{ /* main.c - main() and some logging routines for expect Written by: Don Libes, NIST, 2/6/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include "expect_cf.h" #include <stdio.h> #include INCLUDE_TCL #include "expect_tcl.h" void main(argc, argv) int argc; char *argv[]; { int rc = 0; Tcl_Interp *interp = Tcl_CreateInterp(); int SWIG_init(Tcl_Interp *); if (Tcl_Init(interp) == TCL_ERROR) { fprintf(stderr,"Tcl_Init failed: %s\n",interp->result); exit(1); } if (Exp_Init(interp) == TCL_ERROR) { fprintf(stderr,"Exp_Init failed: %s\n",interp->result); exit(1); } /* SWIG initialization. --- 2/11/96 */ if (SWIG_init(interp) == TCL_ERROR) { fprintf(stderr,"SWIG initialization failed: %s\n", interp->result); exit(1); } exp_parse_argv(interp,argc,argv); /* become interactive if requested or "nothing to do" */ if (exp_interactive) (void) exp_interpreter(interp); else if (exp_cmdfile) rc = exp_interpret_cmdfile(interp,exp_cmdfile); else if (exp_cmdfilename) rc = exp_interpret_cmdfilename(interp,exp_cmdfilename); /* assert(exp_cmdlinecmds != 0) */ exp_exit(interp,rc); /*NOTREACHED*/ } %}
In the event that you need to write a new library file such as this, the process usually isn't too difficult. Start by grabbing the original Tcl_AppInit() function for the package. Enclose it in a %{,%} block. Now add a line that makes a call to SWIG_init(). This will automatically resolve to the real initialization function when compiled.
Both files declare the proper initialization function (to be C++ friendly, this should be done using extern "C"). A call to the initialization function is then placed inside a %init %{ ... %} block.// blt.i : SWIG library file for initializing the BLT extension %{ #ifdef __cplusplus extern "C" { #endif extern int Blt_Init(Tcl_Interp *); #ifdef __cplusplus } #endif %} %init %{ if (Blt_Init(interp) == TCL_ERROR) { return TCL_ERROR; } %} // tix.i : SWIG library file for initializing the Tix extension %{ #ifdef __cplusplus extern "C" { #endif extern int Tix_Init(Tcl_Interp *); #ifdef __cplusplus } #endif %} %init %{ if (Tix_Init(interp) == TCL_ERROR) { return TCL_ERROR; } %}
To use our library files and build a new version of wish, we might now do the following :
Of course, the really cool part about all of this is that the file `mywish.i' can itself, serve as a library file. Thus, when building various versions of Tcl, we can place everything we want to use a special file and use it in all of our other interface files :// mywish.i : wish with a bunch of stuff added to it %include wish.i %include blt.i %include tix.i ... additional declarations ...
or we can grab it on the command line :// interface.i %module mymodule %include mywish.i // Build our version of Tcl with extensions ... C declarations ...
unix > swig -tcl -lmywish.i interface.i
%init %{ Tcl_PkgProvide(interp,"example","0.0"); %}
Where "example" is the name of the package and "0.0" is the version of the package.
Next, after building the SWIG generated module, you need to execute the "pkg_mkIndex" command inside tclsh. For example :
This creates a file "pkgIndex.tcl" with information about the package. To use yourunix > tclsh % pkg_mkIndex . example.so % exit
package, you now need to move it to its own subdirectory which has the same name as the package. For example :
./example/ pkgIndex.tcl # The file created by pkg_mkIndex example.so # The SWIG generated module
Finally, assuming that you're not entirely confused at this point, make sure that the example subdirectory is visible from the directories contained in either the tcl_library or auto_path variables. At this point you're ready to use the package as follows :
unix > tclsh % package require example % fact 4 24 %
If you're working with an example in the current directory and this doesn't work, do this instead :
unix > tclsh % lappend auto_path . % package require example % fact 4 24
As a final note, most SWIG examples do not yet use the package commands. For simple extensions it may be easier just to use the load command instead.
While these could be called directly, we could also write a Tcl script like this :/* File : array.i */ %module array %inline %{ double *new_double(int size) { return (double *) malloc(size*sizeof(double)); } void delete_double(double *a) { free(a); } double get_double(double *a, int index) { return a[index]; } void set_double(double *a, int index, double val) { a[index] = val; } int *new_int(int size) { return (int *) malloc(size*sizeof(int)); } void delete_int(int *a) { free(a); } int get_int(int *a, int index) { return a[index]; } int set_int(int *a, int index, int val) { a[index] = val; } %}
proc Array {type size} { set ptr [new_$type $size] set code { set method [lindex $args 0] set parms [concat $ptr [lrange $args 1 end]] switch $method { get {return [eval "get_$type $parms"]} set {return [eval "set_$type $parms"]} delete {eval "delete_$type $ptr; rename $ptr {}"} } } # Create a procedure uplevel "proc $ptr args {set ptr $ptr; set type $type;$code}" return $ptr }
Our script allows easy array access as follows :
set a [Array double 100] ;# Create a double [100] for {set i 0} {$i < 100} {incr i 1} { ;# Clear the array $a set $i 0.0 } $a set 3 3.1455 ;# Set an individual element set b [$a get 10] ;# Retrieve an element set ia [Array int 50] ;# Create an int[50] for {set i 0} {$i < 50} {incr i 1} { ;# Clear it $ia set $i 0 } $ia set 3 7 ;# Set an individual element set ib [$ia get 10] ;# Get an individual element $a delete ;# Destroy a $ia delete ;# Destroy ia
The cool thing about this approach is that it makes a common interface for two different types of arrays. In fact, if we were to add more C datatypes to our wrapper file, the Tcl code would work with those as well--without modification. If an unsupported datatype was requested, the Tcl code would simply return with an error so there is very little danger of blowing something up (although it is easily accomplished with an out of bounds array access).
# swig_c++.tcl # Provides a simple object oriented interface using # SWIG's low level interface. # proc new {objectType handle_r args} { # Creates a new SWIG object of the given type, # returning a handle in the variable "handle_r". # # Also creates a procedure for the object and a trace on # the handle variable that deletes the object when the # handle varibale is overwritten or unset upvar $handle_r handle # # Create the new object # eval set handle \[new_$objectType $args\] # # Set up the object procedure # proc $handle {cmd args} "eval ${objectType}_\$cmd $handle \$args" # # And the trace ... # uplevel trace variable $handle_r uw "{deleteObject $objectType $handle}" # # Return the handle so that 'new' can be used as an argument to a procedure # return $handle } proc deleteObject {objectType handle name element op} { # # Check that the object handle has a reasonable form # if {![regexp {_[0-9a-f]*_(.+)_p} $handle]} { error "deleteObject: not a valid object handle: $handle" } # # Remove the object procedure # catch {rename $handle {}} # # Delete the object # delete_$objectType $handle } proc delete {handle_r} { # # A synonym for unset that is more familiar to C++ programmers # uplevel unset $handle_r }
To use this file, we simply source it and execute commands such as "new" and "delete" to manipulate objects. For example :
// list.i %module List %{ #include "list.h" %} // Very simple C++ example class List { public: List(); // Create a new list ~List(); // Destroy a list int search(char *value); void insert(char *); // Insert a new item into the list void remove(char *); // Remove item from list char *get(int n); // Get the nth item in the list int length; // The current length of the list static void print(List *l); // Print out the contents of the list };
Now a Tcl script using the interface...
The cool thing about this example is that it works with any C++ object wrapped by SWIG and requires no special compilation. Proof that a short, but clever Tcl script can be combined with SWIG to do many interesting things.load ./list.so list ; # Load the module source swig_c++.tcl ; # Source the object file new List l $l insert Dave $l insert John $l insert Guido $l remove Dave puts $l length_get delete l
To use the plugin, use the -plugin option :
This adds a "safe" initialization function compatible with the plugin (in reality, it just calls the function SWIG already creates). You also need to put the following symbol in your interface file for it to work :swig -tcl -plugin interface.i
The folks at Sun are quite concerned about the security implications of this sort of extension and originally wanted the user to modify the wrapper code by hand to "remind" them that they were installing functions into a safe interpreter. However, having seen alot of SWIG generated wrapper code, I hated that idea (okay, so the output of SWIG is just a little messy). This is compromise--you need to put that #define into your C file someplace. You can also just make it a compiler option if you would like.%{ #define SAFE_SWIG %}
unix > gcc -I/usr/local/include -c example.o interface_wrap.c unix > ld -shared example.o interface_wrap.o \ -L/home/beazley/.netscape/plugins/libtclplugin.so -o example.so
With luck, you will now be ready to run (at least that's the theory).load $tcl_library/example.so example
The Tcl 8.0 module uses the new Tcl 8.0 object interface whenever possible. Instead of using strings, the object interface provides more direct access to objects in their native representation. As a result, the performance is significantly better. The older Tcl SWIG module is also compatible with Tcl 8.0, but since it uses strings it will be much slower than the new version.
In addition to using native Tcl objects, the Tcl8.0 manipulates pointers directly in in a special Tcl object. On the surface it still looks like a string, but internally its represented a (value,type) pair. This too, should offer somewhat better performance.