From 05cbc9d919b4d5b77b6bea0ee83e6a854127f1f6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Feb 2011 14:13:00 -0700 Subject: [PATCH 1/8] Fix #9051 (Amazon cover download appears to be broken) --- src/calibre/ebooks/metadata/amazon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/amazon.py b/src/calibre/ebooks/metadata/amazon.py index 98a2ac6d36..58dd3f1d22 100644 --- a/src/calibre/ebooks/metadata/amazon.py +++ b/src/calibre/ebooks/metadata/amazon.py @@ -50,7 +50,7 @@ def to_asin(br, isbn): else: asin = isbn with cache_lock: - asin_cache[isbn] = ans if ans else False + asin_cache[isbn] = asin if asin else False return asin From 152f56945596bc1065bb3c685e6c5eb3c5cd1a83 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Feb 2011 15:06:58 -0700 Subject: [PATCH 2/8] Add a reupload command to make uploading fixed builds easier --- setup/commands.py | 5 +-- setup/upload.py | 83 +++++++++++++++++++++++++++++++++++------------ 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/setup/commands.py b/setup/commands.py index 12fb5fe0af..7e22ff14f3 100644 --- a/setup/commands.py +++ b/setup/commands.py @@ -17,7 +17,7 @@ __all__ = [ 'manual', 'tag_release', 'pypi_register', 'pypi_upload', 'upload_to_server', 'upload_user_manual', 'upload_to_mobileread', 'upload_demo', - 'upload_to_sourceforge', 'upload_to_google_code', + 'upload_to_sourceforge', 'upload_to_google_code', 'reupload', 'linux32', 'linux64', 'linux', 'linux_freeze', 'osx32_freeze', 'osx', 'rsync', 'push', 'win32_freeze', 'win32', 'win', @@ -63,13 +63,14 @@ stage4 = Stage4() publish = Publish() from setup.upload import UploadUserManual, UploadInstallers, UploadDemo, \ - UploadToServer, UploadToSourceForge, UploadToGoogleCode + UploadToServer, UploadToSourceForge, UploadToGoogleCode, ReUpload upload_user_manual = UploadUserManual() upload_to_mobileread = UploadInstallers() upload_demo = UploadDemo() upload_to_server = UploadToServer() upload_to_sourceforge = UploadToSourceForge() upload_to_google_code = UploadToGoogleCode() +reupload = ReUpload() from setup.installer import Rsync, Push rsync = Rsync() diff --git a/setup/upload.py b/setup/upload.py index 1917e0ab1f..cb363be5d7 100644 --- a/setup/upload.py +++ b/setup/upload.py @@ -39,8 +39,22 @@ def installer_description(fname): return 'OS X dmg' return 'Unknown file' +class ReUpload(Command): # {{{ -class UploadToGoogleCode(Command): + description = 'Re-uplaod any installers present in dist/' + + sub_commands = ['upload_to_google_code', 'upload_to_sourceforge'] + + def pre_sub_commands(self, opts): + opts.re_upload = True + + def run(self, opts): + for x in installers(): + if os.path.exists(x): + os.remove(x) +# }}} + +class UploadToGoogleCode(Command): # {{{ USERNAME = 'kovidgoyal' # Password can be gotten by going to @@ -52,21 +66,49 @@ class UploadToGoogleCode(Command): UPLOAD_HOST = 'calibre-ebook.googlecode.com' FILES_LIST = 'http://code.google.com/p/calibre-ebook/downloads/list' + def add_options(self, parser): + parser.add_option('--re-upload', default=False, action='store_true', + help='Re-upload all installers currently in dist/') + + def re_upload(self): + fnames = set([os.path.basename(x) for x in installers() if not + x.endswith('.tar.gz') and os.path.exists(x)]) + existing = set(self.old_files.keys()).intersection(fnames) + br = self.login_to_gmail() + for x in fnames: + src = os.path.join('dist', x) + if not os.access(src, os.R_OK): + continue + if x in existing: + self.info('Deleting', x) + br.open('http://code.google.com/p/calibre-ebook/downloads/delete?name=%s'%x) + br.select_form(predicate=lambda y: 'delete.do' in y.action) + br.form.find_control(name='delete') + br.submit(name='delete') + self.upload_one(src) + + def upload_one(self, fname): + self.info('Uploading', fname) + typ = 'Type-Source' if fname.endswith('.gz') else 'Type-Installer' + ext = os.path.splitext(fname)[1][1:] + op = 'OpSys-'+{'msi':'Windows','dmg':'OSX','bz2':'Linux','gz':'All'}[ext] + desc = installer_description(fname) + path = self.upload(os.path.abspath(fname), desc, + labels=[typ, op, 'Featured']) + self.info('\tUploaded to:', path) + return path + def run(self, opts): self.opts = opts self.password = open(self.PASSWORD_FILE).read().strip() self.paths = {} self.old_files = self.get_files_hosted_by_google_code() + if opts.re_upload: + return self.re_upload() + for fname in installers(): - self.info('Uploading', fname) - typ = 'Type-Source' if fname.endswith('.gz') else 'Type-Installer' - ext = os.path.splitext(fname)[1][1:] - op = 'OpSys-'+{'msi':'Windows','dmg':'OSX','bz2':'Linux','gz':'All'}[ext] - desc = installer_description(fname) - path = self.upload(os.path.abspath(fname), desc, - labels=[typ, op, 'Featured']) - self.info('\tUploaded to:', path) + path = self.upload_one(fname) self.paths[os.path.basename(fname)] = path self.info('Updating path map') self.info(repr(self.paths)) @@ -189,11 +231,9 @@ class UploadToGoogleCode(Command): return self.upload(fname, desc, labels=labels, retry=retry+1) raise Exception('Failed to upload '+fname) +# }}} - - - -class UploadToSourceForge(Command): +class UploadToSourceForge(Command): # {{{ description = 'Upload release files to sourceforge' @@ -217,9 +257,10 @@ class UploadToSourceForge(Command): self.opts = opts self.upload_installers() +# }}} -class UploadInstallers(Command): - description = 'Upload any installers present in dist/' +class UploadInstallers(Command): # {{{ + description = 'Upload any installers present in dist/ to mobileread' def curl_list_dir(self, url=MOBILEREAD, listonly=1): import pycurl c = pycurl.Curl() @@ -289,17 +330,18 @@ class UploadInstallers(Command): installers = list(map(installer_name, ('dmg', 'msi', 'tar.bz2'))) installers.append(installer_name('tar.bz2', is64bit=True)) map(self.upload_installer, installers) +# }}} -class UploadUserManual(Command): +class UploadUserManual(Command): # {{{ description = 'Build and upload the User Manual' sub_commands = ['manual'] def run(self, opts): check_call(' '.join(['scp', '-r', 'src/calibre/manual/.build/html/*', 'divok:%s'%USER_MANUAL]), shell=True) +# }}} - -class UploadDemo(Command): +class UploadDemo(Command): # {{{ description = 'Rebuild and upload various demos' @@ -317,8 +359,9 @@ class UploadDemo(Command): 'zip -j /tmp/html-demo.zip * /tmp/html2lrf.lrf', shell=True) check_call('scp /tmp/html-demo.zip divok:%s/'%(DOWNLOADS,), shell=True) +# }}} -class UploadToServer(Command): +class UploadToServer(Command): # {{{ description = 'Upload miscellaneous data to calibre server' @@ -348,6 +391,6 @@ class UploadToServer(Command): check_call('scp %s/*.sha512 divok:%s/signatures/' % (tdir, DOWNLOADS), shell=True) shutil.rmtree(tdir) - +# }}} From 9adc087ad51ba4d2e18be97c92fc406190925e8f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Feb 2011 17:05:19 -0700 Subject: [PATCH 3/8] Roger Ebert Journal by Shane Erstad --- resources/recipes/roger_ebert_blog.recipe | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 resources/recipes/roger_ebert_blog.recipe diff --git a/resources/recipes/roger_ebert_blog.recipe b/resources/recipes/roger_ebert_blog.recipe new file mode 100644 index 0000000000..d0bd1d3252 --- /dev/null +++ b/resources/recipes/roger_ebert_blog.recipe @@ -0,0 +1,102 @@ +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class EbertJournal(BasicNewsRecipe): + title = 'Roger Ebert Journal' + __author__ = 'Shane Erstad' + description = 'Roger Ebert Journal' + publisher = 'Chicago Sun Times' + category = 'movies' + oldest_article = 8 + max_articles_per_feed = 100 + no_stylesheets = True + use_embedded_content = False + encoding = 'ISO-8859-1' + masthead_url = 'http://rogerebert.suntimes.com/graphics/global/roger.jpg' + language = 'en' + remove_empty_feeds = False + PREFIX = 'http://blogs.suntimes.com/ebert' + + remove_tags_before = dict(id='content') + remove_tags_after = dict(id='comments-open') + + + + + + extra_css = """ + @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} + .article_description,body{font-family: Arial,Helvetica,sans1,sans-serif} + .color-2{display:block; margin-bottom: 10px; padding: 5px, 10px; + border-left: 1px solid #D00000; color: #D00000} + img{margin-bottom: 0.8em} """ + + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + , 'linearize_tables' : True + } + + + feeds = [ + (u'Roger Ebert Journal' , u'http://blogs.suntimes.com/ebert/' ) + ] + + preprocess_regexps = [ + + (re.compile(r'Roger Ebert', re.DOTALL|re.IGNORECASE), + lambda m: 'Roger Ebert'), + + (re.compile(r'', re.DOTALL|re.IGNORECASE), + lambda m: '
'), + + (re.compile(r'
', re.DOTALL|re.IGNORECASE), + lambda m: ''), + + (re.compile(r'', re.DOTALL|re.IGNORECASE), + lambda m: ''), + + (re.compile(r'

Leave a comment

', re.DOTALL|re.IGNORECASE), + lambda m: ''), + + (re.compile(r'a title="Reply".*?
', re.DOTALL|re.IGNORECASE), + lambda m: '') + ] + + + def parse_index(self): + + totalfeeds = [] + lfeeds = self.get_feeds() + for feedobj in lfeeds: + feedtitle, feedurl = feedobj + self.report_progress(0, _('Fetching feed')+' %s...'%(feedtitle if feedtitle else feedurl)) + articles = [] + soup = self.index_to_soup(feedurl) + for item in soup.findAll(attrs={'class':['entry-asset asset hentry']}): + + item.find(attrs={'class':['mt-enclosure mt-enclosure-image']}).replaceWith('') + bodysection = item.find(attrs={'class':['asset-body']}) + datesection = item.find(attrs={'class':['published']}) + titlesection = item.find(attrs={'class':['asset-name entry-title']}) + + + self.log(bodysection) + + link = titlesection.find('a') + url = link['href'] + title = self.tag_to_string(link) + self.log(url) + self.log(title) + articles.append({ + 'title' :title + ,'date' :' [' + self.tag_to_string(datesection) + ']' + ,'url' :url + ,'description':self.tag_to_string(bodysection) + }) + totalfeeds.append((feedtitle, articles)) + return totalfeeds + From f6665bc5c8b75789259fab8f13e4d74e9b9fecd3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Feb 2011 17:08:12 -0700 Subject: [PATCH 4/8] Fix regression in 0.7.46 that broke creating date and composite custom columns --- src/calibre/gui2/preferences/create_custom_column.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/preferences/create_custom_column.py b/src/calibre/gui2/preferences/create_custom_column.py index 5cd32a4af3..9974de472f 100644 --- a/src/calibre/gui2/preferences/create_custom_column.py +++ b/src/calibre/gui2/preferences/create_custom_column.py @@ -153,17 +153,17 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn): display_dict = {} if col_type == 'datetime': - if self.date_format_box.text().strip(): + if unicode(self.date_format_box.text()).strip(): display_dict = {'date_format':unicode(self.date_format_box.text()).strip()} else: display_dict = {'date_format': None} elif col_type == 'composite': - if not self.composite_box.text().strip(): + if not unicode(self.composite_box.text()).strip(): return self.simple_error('', _('You must enter a template for' ' composite columns')) display_dict = {'composite_template':unicode(self.composite_box.text()).strip()} elif col_type == 'enumeration': - if not self.enum_box.text(): + if not unicode(self.enum_box.text()).strip(): return self.simple_error('', _('You must enter at least one' ' value for enumeration columns')) l = [v.strip() for v in unicode(self.enum_box.text()).split(',')] From 8842197e6f0938dd8163e3140fa30e982d299ea6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Feb 2011 19:32:03 -0700 Subject: [PATCH 5/8] ... --- resources/recipes/roger_ebert_blog.recipe | 144 +++++++++++++--------- 1 file changed, 89 insertions(+), 55 deletions(-) diff --git a/resources/recipes/roger_ebert_blog.recipe b/resources/recipes/roger_ebert_blog.recipe index d0bd1d3252..6bfe143146 100644 --- a/resources/recipes/roger_ebert_blog.recipe +++ b/resources/recipes/roger_ebert_blog.recipe @@ -1,35 +1,41 @@ import re +import urllib2 +import time from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import BeautifulSoup, SoupStrainer +from calibre import strftime -class EbertJournal(BasicNewsRecipe): - title = 'Roger Ebert Journal' +''' + Help Needed: + Still can't figure out why I'm getting strange characters. Esp. the Great Movies descriptions in the TOC. + Anyone help me figure that out? + + Change Log: + 2011-02-19: Version 2: Added "Oscars" section and fixed date problem +''' + +class Ebert(BasicNewsRecipe): + title = 'Roger Ebert' __author__ = 'Shane Erstad' - description = 'Roger Ebert Journal' + version = 2 + description = 'Roger Ebert Movie Reviews' publisher = 'Chicago Sun Times' category = 'movies' oldest_article = 8 max_articles_per_feed = 100 no_stylesheets = True use_embedded_content = False - encoding = 'ISO-8859-1' + encoding = 'UTF-8' masthead_url = 'http://rogerebert.suntimes.com/graphics/global/roger.jpg' language = 'en' remove_empty_feeds = False - PREFIX = 'http://blogs.suntimes.com/ebert' + PREFIX = 'http://rogerebert.suntimes.com' + patternReviews = r'(.*?).*?
(.*?)
(.*?)' + patternCommentary = r'
.*?(.*?).*?
(.*?)
' + patternPeople = r'
.*?(.*?).*?
(.*?)
' + patternOscars = r'
.*?(.*?).*?
(.*?)
' + patternGlossary = r'
.*?(.*?).*?
(.*?)
' - remove_tags_before = dict(id='content') - remove_tags_after = dict(id='comments-open') - - - - - - extra_css = """ - @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} - .article_description,body{font-family: Arial,Helvetica,sans1,sans-serif} - .color-2{display:block; margin-bottom: 10px; padding: 5px, 10px; - border-left: 1px solid #D00000; color: #D00000} - img{margin-bottom: 0.8em} """ conversion_options = { @@ -42,61 +48,89 @@ class EbertJournal(BasicNewsRecipe): feeds = [ - (u'Roger Ebert Journal' , u'http://blogs.suntimes.com/ebert/' ) + (u'Reviews' , u'http://rogerebert.suntimes.com/apps/pbcs.dll/section?category=reviews' ) + ,(u'Commentary' , u'http://rogerebert.suntimes.com/apps/pbcs.dll/section?category=COMMENTARY') + ,(u'Great Movies' , u'http://rogerebert.suntimes.com/apps/pbcs.dll/section?category=REVIEWS08') + ,(u'People' , u'http://rogerebert.suntimes.com/apps/pbcs.dll/section?category=PEOPLE') + ,(u'Oscars' , u'http://rogerebert.suntimes.com/apps/pbcs.dll/section?category=OSCARS') + ,(u'Glossary' , u'http://rogerebert.suntimes.com/apps/pbcs.dll/section?category=GLOSSARY') + ] preprocess_regexps = [ - - (re.compile(r'Roger Ebert', re.DOTALL|re.IGNORECASE), - lambda m: 'Roger Ebert'), - - (re.compile(r'', re.DOTALL|re.IGNORECASE), - lambda m: '
'), - - (re.compile(r'
', re.DOTALL|re.IGNORECASE), - lambda m: ''), - - (re.compile(r'', re.DOTALL|re.IGNORECASE), - lambda m: ''), - - (re.compile(r'

Leave a comment

', re.DOTALL|re.IGNORECASE), - lambda m: ''), - - (re.compile(r'a title="Reply".*?
', re.DOTALL|re.IGNORECASE), + (re.compile(r'.*?This is a printer friendly.*?.*?
', re.DOTALL|re.IGNORECASE), lambda m: '') ] - def parse_index(self): + def print_version(self, url): + return url + '&template=printart' + + def parse_index(self): totalfeeds = [] lfeeds = self.get_feeds() for feedobj in lfeeds: feedtitle, feedurl = feedobj + self.log('\tFeedurl: ', feedurl) self.report_progress(0, _('Fetching feed')+' %s...'%(feedtitle if feedtitle else feedurl)) articles = [] - soup = self.index_to_soup(feedurl) - for item in soup.findAll(attrs={'class':['entry-asset asset hentry']}): + page = urllib2.urlopen(feedurl).read() - item.find(attrs={'class':['mt-enclosure mt-enclosure-image']}).replaceWith('') - bodysection = item.find(attrs={'class':['asset-body']}) - datesection = item.find(attrs={'class':['published']}) - titlesection = item.find(attrs={'class':['asset-name entry-title']}) + if feedtitle == 'Reviews' or feedtitle == 'Great Movies': + pattern = self.patternReviews + elif feedtitle == 'Commentary': + pattern = self.patternCommentary + elif feedtitle == 'People': + pattern = self.patternPeople + elif feedtitle == 'Glossary': + pattern = self.patternGlossary + elif feedtitle == 'Oscars': + pattern = self.patternOscars - self.log(bodysection) + regex = re.compile(pattern, re.IGNORECASE|re.DOTALL) - link = titlesection.find('a') - url = link['href'] - title = self.tag_to_string(link) - self.log(url) - self.log(title) - articles.append({ - 'title' :title - ,'date' :' [' + self.tag_to_string(datesection) + ']' - ,'url' :url - ,'description':self.tag_to_string(bodysection) + for match in regex.finditer(page): + if feedtitle == 'Reviews' or feedtitle == 'Great Movies': + movietitle = match.group(1) + thislink = match.group(2) + description = match.group(3) + elif feedtitle == 'Commentary' or feedtitle == 'People' or feedtitle == 'Glossary' or feedtitle == 'Oscars': + thislink = match.group(1) + description = match.group(2) + + self.log(thislink) + + for link in BeautifulSoup(thislink, parseOnlyThese=SoupStrainer('a')): + thisurl = self.PREFIX + link['href'] + thislinktext = self.tag_to_string(link) + + if feedtitle == 'Reviews' or feedtitle == 'Great Movies': + thistitle = movietitle + elif feedtitle == 'Commentary' or feedtitle == 'People' or feedtitle == 'Glossary' or feedtitle == 'Oscars': + thistitle = thislinktext + + if thistitle == '': + continue + + + pattern2 = r'AID=\/(.*?)\/' + reg2 = re.compile(pattern2, re.IGNORECASE|re.DOTALL) + match2 = reg2.search(thisurl) + if match2: + c = time.strptime(match2.group(1),"%Y%m%d") + mydate=strftime("%A, %B %d, %Y", c) + else: + mydate = strftime("%A, %B %d, %Y") + self.log(mydate) + + articles.append({ + 'title' :thistitle + ,'date' :' [' + mydate + ']' + ,'url' :thisurl + ,'description':description }) totalfeeds.append((feedtitle, articles)) - return totalfeeds + return totalfeeds From 0aa080e78ef9204190d8e25e6ae455aeb54dd62b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Feb 2011 00:07:51 -0700 Subject: [PATCH 6/8] Fix deprecated libpng io_ptr direct access --- src/calibre/ebooks/pdf/images.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/pdf/images.cpp b/src/calibre/ebooks/pdf/images.cpp index 4cd1ace776..0e7d8b0d70 100644 --- a/src/calibre/ebooks/pdf/images.cpp +++ b/src/calibre/ebooks/pdf/images.cpp @@ -301,7 +301,7 @@ void PNGWriter::write_splash_bitmap(SplashBitmap *bitmap) { void calibre_png_mem_write(png_structp png_ptr, png_bytep data, png_size_t length) { if (!png_ptr || length < 1) return; - vector *buf = static_cast< vector* >(png_ptr->io_ptr); + vector *buf = static_cast< vector* >(png_get_io_ptr(png_ptr)); buf->reserve(buf->capacity() + length); do { buf->push_back(static_cast(*data)); From 3db932cf741bdf9228c78844a61c3b785f4d54e7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Feb 2011 00:10:20 -0700 Subject: [PATCH 7/8] ... --- Changelog.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.yaml b/Changelog.yaml index 5d16dbe146..6c4fc4f447 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -60,6 +60,8 @@ - title: "TXT Input: New paragraph-type option (off) to disable modifying the paragraph structure." - title: "Device driver for the Kendo/Yifang M7 and the Wolder Mibuk Life" + + - title: "For people building calibre from source, note that calibre now requires SIP >= 4.12 to build" bug fixes: - title: "Fix main memory and storage card for Cybook Orizon being swapped with some firmwares" From b1c003f5af72bc585e04aad8626929d691734924 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Feb 2011 00:25:17 -0700 Subject: [PATCH 8/8] Fix all warnings when compiling chmlib wrapper --- src/calibre/utils/chm/swig_chm.c | 103 +------------------------------ 1 file changed, 1 insertion(+), 102 deletions(-) diff --git a/src/calibre/utils/chm/swig_chm.c b/src/calibre/utils/chm/swig_chm.c index d86c986b43..80587d7f86 100644 --- a/src/calibre/utils/chm/swig_chm.c +++ b/src/calibre/utils/chm/swig_chm.c @@ -164,36 +164,6 @@ SWIG_TypeCast(swig_type_info *ty, void *ptr) return (*ty->converter)(ptr); } -/* Dynamic pointer casting. Down an inheritance hierarchy */ -SWIGRUNTIME(swig_type_info *) -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) -{ - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* Return the name associated with this type */ -SWIGRUNTIME(const char *) -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* Search for a swig_type_info structure */ -SWIGRUNTIME(swig_type_info *) -SWIG_TypeQuery(const char *name) { - swig_type_info *ty = swig_type_list; - while (ty) { - if (ty->str && (strcmp(name,ty->str) == 0)) return ty; - if (ty->name && (strcmp(name,ty->name) == 0)) return ty; - ty = ty->prev; - } - return 0; -} /* Set the clientdata field for a type */ SWIGRUNTIME(void) @@ -365,21 +335,6 @@ SWIG_newvarlink(void) { return ((PyObject*) result); } -SWIGRUNTIME(void) -SWIG_addvarlink(PyObject *p, char *name, - PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { - swig_varlinkobject *v; - swig_globalvar *gv; - v= (swig_varlinkobject *) p; - gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); - gv->name = (char *) malloc(strlen(name)+1); - strcpy(gv->name,name); - gv->get_attr = get_attr; - gv->set_attr = set_attr; - gv->next = v->vars; - v->vars = gv; -} - /* Pack binary data into a string */ SWIGRUNTIME(char *) SWIG_PackData(char *c, void *ptr, int sz) { @@ -395,29 +350,6 @@ SWIG_PackData(char *c, void *ptr, int sz) { return c; } -/* Unpack binary data from a string */ -SWIGRUNTIME(char *) -SWIG_UnpackData(char *c, void *ptr, int sz) { - register unsigned char uu = 0; - register int d; - unsigned char *u = (unsigned char *) ptr; - int i; - for (i = 0; i < sz; i++, u++) { - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - *u = uu; - } - return c; -} - /* Convert a pointer value */ SWIGRUNTIME(int) SWIG_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) { @@ -510,39 +442,6 @@ type_error: return -1; } -/* Convert a packed value value */ -SWIGRUNTIME(int) -SWIG_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) { - swig_type_info *tc; - char *c; - - if ((!obj) || (!PyString_Check(obj))) goto type_error; - c = PyString_AsString(obj); - /* Pointer values must start with leading underscore */ - if (*c != '_') goto type_error; - c++; - c = SWIG_UnpackData(c,ptr,sz); - if (ty) { - tc = SWIG_TypeCheck(c,ty); - if (!tc) goto type_error; - } - return 0; - -type_error: - - if (flags) { - if (ty) { - char *temp = (char *) malloc(64+strlen(ty->name)); - sprintf(temp,"Type error. Expected %s", ty->name); - PyErr_SetString(PyExc_TypeError, temp); - free((char *) temp); - } else { - PyErr_SetString(PyExc_TypeError,"Expected a pointer"); - } - } - return -1; -} - /* Create a new pointer object */ SWIGRUNTIME(PyObject *) SWIG_NewPointerObj(void *ptr, swig_type_info *type, int own) { @@ -1071,7 +970,7 @@ static PyObject *_wrap_chm_retrieve_object(PyObject *self, PyObject *args) { resultobj = PyLong_FromLongLong(result); { PyObject *o; - o = PyString_FromStringAndSize(arg3, arg5); + o = PyString_FromStringAndSize((const char *)arg3, arg5); resultobj = t_output_helper(resultobj,o);