The OSI Superboard II was the computer on which I first learned to program back in 1979. Python is why programming remains fun today. In this tale of old meets new, I describe how I have used Python 3 to create a cloud computing service for my still-working Superboard--a problem complicated by it only having 8Kb of RAM and 300-baud cassette tape audio ports for I/O.
The PyConTW (http://tw.pycon.org) organizer wishes to improve the quality and quantity of the programming cummunities in Taiwan. Though Python is their core tool and methodology, they know it's worth to learn and communicate with wide-ranging communities. Understanding cultures and ecosystem of a language takes me about three to six months. This six-hour course wraps up what I - an experienced Java developer - have learned from Python ecosystem and the agenda of the past PyConTW.
你可以在以下鏈結找到中文內容:
http://www.codedata.com.tw/python/python-tutorial-the-1st-class-1-preface
Beating the (sh** out of the) GIL - Multithreading vs. MultiprocessingGuy K. Kloss
Talk given at the June 2008 meeting of the New Zealand Python User Group in Auckland.
Outline: An overview to approaches for parallel/concurrent programming in Python.
Code demonstrated in the presentation can be found here:
http://www.kloss-familie.de/moin/TalksPresentations
The genesis of clusterlib - An open source library to tame your favourite sup...Arnaud Joly
The presentations tells the story of clusterlib an open source package from the problem statement to a first grade an open source library. Awesome tools are also presented for software projects.
The goal of the clusterlib is to ease the creation, launch and management of embarrassingly parallel jobs on supercomputers with schedulers such as SLURM and SGE.
The goal of this presentation is to broaden your knowledge of Python, exploring some concepts and techniques you might have never heard about. I won't go into too much detail, the goal is only to inspire you to research those features and patterns.
Simple Data Engineering in Python 3.5+ — Pycon.DE 2017 Karlsruhe — Bonobo ETLRomain Dorgueil
Simple Data Engineering in Python 3.5+ using Bonobo ETL, with real world example using Django2 and DBPedia.
https://www.bonobo-project.org/
Presentation from Pycon.DE 2017 in Karlsruhe
Audio for websites has a very checkered past. Finally, however, we can forget about using media tags like “embed” & “object”, and browser plugins like flash, along with the annoying “bgsound” of IE. The HTML5 <audio> tag is a big step forward…. But the “Web Audio API”, modeled on a graph of “audio nodes” providing filters, gains, spectral analysis, and spatially-located sound sources, is more of a giant leap forward for sounds in games and online music synthesis. That, along with “getUserMedia” to capture real-time camera and microphone input are arriving “as we speak”. Plan on lots of eye- (and ear-) candy to whet your appetite, with a modest taste of geeky codes and advances in Javascript Arrays and XHR2.
The OSI Superboard II was the computer on which I first learned to program back in 1979. Python is why programming remains fun today. In this tale of old meets new, I describe how I have used Python 3 to create a cloud computing service for my still-working Superboard--a problem complicated by it only having 8Kb of RAM and 300-baud cassette tape audio ports for I/O.
The PyConTW (http://tw.pycon.org) organizer wishes to improve the quality and quantity of the programming cummunities in Taiwan. Though Python is their core tool and methodology, they know it's worth to learn and communicate with wide-ranging communities. Understanding cultures and ecosystem of a language takes me about three to six months. This six-hour course wraps up what I - an experienced Java developer - have learned from Python ecosystem and the agenda of the past PyConTW.
你可以在以下鏈結找到中文內容:
http://www.codedata.com.tw/python/python-tutorial-the-1st-class-1-preface
Beating the (sh** out of the) GIL - Multithreading vs. MultiprocessingGuy K. Kloss
Talk given at the June 2008 meeting of the New Zealand Python User Group in Auckland.
Outline: An overview to approaches for parallel/concurrent programming in Python.
Code demonstrated in the presentation can be found here:
http://www.kloss-familie.de/moin/TalksPresentations
The genesis of clusterlib - An open source library to tame your favourite sup...Arnaud Joly
The presentations tells the story of clusterlib an open source package from the problem statement to a first grade an open source library. Awesome tools are also presented for software projects.
The goal of the clusterlib is to ease the creation, launch and management of embarrassingly parallel jobs on supercomputers with schedulers such as SLURM and SGE.
The goal of this presentation is to broaden your knowledge of Python, exploring some concepts and techniques you might have never heard about. I won't go into too much detail, the goal is only to inspire you to research those features and patterns.
Simple Data Engineering in Python 3.5+ — Pycon.DE 2017 Karlsruhe — Bonobo ETLRomain Dorgueil
Simple Data Engineering in Python 3.5+ using Bonobo ETL, with real world example using Django2 and DBPedia.
https://www.bonobo-project.org/
Presentation from Pycon.DE 2017 in Karlsruhe
Audio for websites has a very checkered past. Finally, however, we can forget about using media tags like “embed” & “object”, and browser plugins like flash, along with the annoying “bgsound” of IE. The HTML5 <audio> tag is a big step forward…. But the “Web Audio API”, modeled on a graph of “audio nodes” providing filters, gains, spectral analysis, and spatially-located sound sources, is more of a giant leap forward for sounds in games and online music synthesis. That, along with “getUserMedia” to capture real-time camera and microphone input are arriving “as we speak”. Plan on lots of eye- (and ear-) candy to whet your appetite, with a modest taste of geeky codes and advances in Javascript Arrays and XHR2.
Докладчик:
Игорь Стариков
Описание:
Не секрет, что Питон, благодаря своим свойствам, имеет широчайшую область применения. Не являются исключением и мультимедийные (в том числе игровые) приложения.
В ходе этого выступления:
1. вы узнаете о некоторых средствах и принципах их построения, а также о том, как упомянутые средства могут использовать функции внешних библиотек, написанных на других языках программирования;
2. а я получу, наконец, достижение из одной известной игры, не запуская её.
FLOW3 is a web application platform which uses Domain-Driven Design as its major underlying concept. This approach makes FLOW3 easy to learn and at the same time clean and flexible for complex projects. It features namespaces, has an emphasis on clean, object-oriented code and provides a seemless Doctrine 2 integration.
FLOW3 incorporates Dependency Injection in a way which lets you truly enjoy creating a stable and easy-to-test application architecture (no configuration necessary). Being the only Aspect-Oriented Programming capable PHP framework, FLOW3 allows you to cleanly separate cross-cutting concerns like security from your main application logic.
This tutorial takes you through an imaginary project from scratch. During the journey we’ll visit all important areas of the framework.
From the International PHP Conference (Spring Edition) 2012, in Berlin, Germany.
FLOW3 is a web application platform which uses Domain-Driven Design as its major underlying concept. This approach makes FLOW3 easy to learn and at the same time clean and flexible for complex projects. It features namespaces, has an emphasis on clean, object-oriented code and provides a seemless Doctrine 2 integration. FLOW3 incorporates Dependency Injection in a way which lets you truly enjoy creating a stable and easy-to-test application architecture (no configuration necessary). Being the only Aspect-Oriented Programming capable PHP framework, FLOW3 allows you to cleanly separate cross-cutting concerns like security from your main application logic. This tutorial takes you through an imaginary project from scratch. During the journey we’ll visit all important areas of the framework.
FLOW3 1.0 – scheduled for the 2nd quarter of 2011 – is an application framework aiming to back up developers with security and infrastructure while they focus on the application logic. With Domain-Driven Design as its major underlying concept, FLOW3 is easy to learn but flexible enough for complex projects.
This session from the International PHP Conference 2011 (Spring) provides a comprehensive overview of the main strengths of FLOW3.
Objective-C is a Smalltalk-like Object-Oriented layer on top of the C language. It is the official language of OS X and iOS. Assuming you have a background in Object-Oriented Programming and a basic understanding of the C language or syntax, this talk will cover everything you need to know about Objective-C. By the end of the talk, you will understand how to make and use your own objects, the Foundation Framework and the data structures it provides, and the Objective-C specific language constructs and syntactic-sugar.
Python Foundation – A programmer's introduction to Python concepts & styleKevlin Henney
This is a two-day course in Python programming aimed at professional programmers. The course material provided here is intended to be used by teachers of the language, but individual learners might find some of this useful as well.
The course assume the students already know some Python, but that they feel a need to establish a solid understanding of the language to further develop their skills.
The course is released under Creative Commons Attribution 4.0. Its primary location (along with some sample solutions and the original PowerPoint) is at https://github.com/JonJagger/two-day-courses/tree/master/pf
C Tutorial, Clanguage,
C Programming Tutorial
C - Home
C - Overview
C - Environment Setup
C - Program Structure
C - Basic Syntax
C - Data Types
C - Variables
C - Constants
C - Storage Classes
C - Operators
C - Decision Making
C - Loops
C - Functions
C - Scope Rules
C - Arrays
C - Pointers
C - Strings
C - Structures
C - Unions
C - Bit Fields
C - Typedef
C - Input & Output
C - File I/O
C - Preprocessors
C - Header Files
C - Type Casting
C - Error Handling
C - Recursion
C - Variable Arguments
C - Memory Management
C - Command Line Arguments
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
1. Perl-C/C++ Integration with Swig
Dave Beazley
Department of Computer Science
University of Chicago
Chicago, IL 60637
beazley@cs.uchicago.edu
August 23, 1999
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
2. Roadmap
What is Swig?
How does it work?
Why would you want to use it?
Advanced features.
Limitations and rough spots.
Future plans.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
3. What is Swig?
It’s a compiler for connecting C/C++ with interpreters
General idea:
• Take a C program or library
• Grab its external interface (e.g., a header file).
• Feed to Swig.
• Compile into an extension module.
• Run from Perl (or Python, Tcl, etc...)
• Life is good.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
4. Swig, h2xs and xsubpp
Perl already has extension building tools
• xsubpp
• h2xs
• Makemaker
• Primarily used for extension building and distribution.
Why use Swig?
• Much less internals oriented.
• General purpose (also supports Python, Tcl, etc...)
• Better support for structures, classes, pointers, etc...
Also...
• Target audience is primarily C/C++ programmers.
• Not Perl extension writers (well, not really).
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
5. How does it work?
Typical C program Header file
main() extern int foo(int n);
extern double bar;
Functions struct Person {
Variables char *name;
Objects char *email;
};
Interesting C Program Swig Interface
Perl %module myprog
Swig
%{
Wrappers #include "myprog.h"
%}
Functions extern int foo(int n);
Variables extern double bar;
Objects struct Person {
char *name;
char *email;
};
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
6. Swig Output
Swig converts interface files into C wrapper code
• Similar to the output of xsubpp.
• It’s nasty and shouldn’t be looked at.
Compilation steps:
• Run Swig
• Compile the wrapper code.
• Link wrappers and original code into a shared library.
• Cross fingers.
If successful...
• Program loads as a Perl extension.
• Can access C/C++ from Perl.
• With few (if any) changes to the C/C++ code (hopefully)
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
7. Example
C Code Perl
int foo(int, int); $r = foo(2,3);
double Global; $Global = 3.14;
#define BAR 5.5 print $BAR;
... ...
Perl becomes an extension of the underlying C/C++ code
• Can invoke functions.
• Modify global variables.
• Access constants.
Almost anything that can be done in C can be done from Perl
• We’ll get to limitations a little later.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
8. Interface Files
Annotated Header Files
Module name %module myprog
Preamble %{
• Inclusion of header files #include "myprog.h"
• Support code %}
• Same idea as in yacc/bison
Public Declarations extern int foo(int n);
• Put anything you want in Perl here
extern double bar;
• Converted into wrappers. struct Person {
• Usually a subset of a header file.
char *name;
char *email;
Note : Can use header files };
• May need conditional compilation.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
9. Supported C/C++ Features
Functions, variables, and constants
• Functions accessed as Perl functions.
• Global variables mapped into magic Perl variables.
• Constants mapped into read-only variables.
All C/C++ datatypes supported except:
• Pointers to functions and pointers to arrays (can fix with a typedef).
• long long and long double
• Variable length arguments.
• Bit-fields (can fix with slight modifications in interface file).
• Pointers to members.
Structures and classes
• Access to members supported through accessor functions.
• Can wrap into Perl "classes."
• Inheritance (including multiple inheritance).
• Virtual and static members.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
10. Pointers
Swig allows arbitrary C pointers to be used
• Turned into blessed references
Pointers are opaque
• Can freely manipulate from Perl.
• But can’t peer inside.
Type-checking
• Pointers encoded with a type to perform run-time checks.
• Better than just casting everything to void * or int.
Works very well with C programs
• Structures, classes, arrays, etc...
• Besides, you can never have too many pointers...
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
11. Shadow Classes
Structures and classes can be hidden behind a Perl class:
C/C++ struct or class C accessor functions
class Foo { Foo *new_Foo();
public: void delete_Foo(Foo *f);
int x; int Foo_x_get(Foo *f);
Foo(); int Foo_x_set(Foo *f, int x);
~Foo(); int Foo_bar(Foo *f, int);
int bar(int); ...
...
}
Perl wrappers Use from a Perl script
package Foo; $f = new Foo;
sub new { $f->bar(3);
return new_Foo(); $f->bar{’x’} = 7;
} del $f;
sub DESTROY {
delete_Foo();
}
...etc...
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
12. Swig Applications
User interfaces
• Use Perl, Python, or Tcl as the interface to a C program.
• This is particularly useful in certain applications.
Rapid prototyping and debugging of C/C++
• Use scripts for testing.
• Prototype new features.
Systems integration
• Use Perl, Python, or Tcl as a glue language.
• Combine C libraries as extension modules.
The key point:
• Swig can greatly simplify these tasks.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
13. Interface Building Problems
Swig attempts to be completely automated.
• "Wrap it and forget it"
Problem : C/C++ code varies widely (and may be a mess)
• Pointer ambiguity (arrays, output values, etc...).
• Preprocessor macros.
• Error handling (exceptions, etc...)
• Advanced C++ (templates, overloading, etc...)
Other problems
• A direct translation of a header file may not work well.
• Swig only understands a subset of C.
• May want to interface with Perl data structures.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
14. Parsing Problems
Swig doesn’t understand certain declarations
• Can remove with conditional compilation or comments
Example:
int foo(char *fmt, ...); // int foo(char *fmt, ...);
int bar(int (*func)(int)); #ifndef SWIG
int bar(int (*func)(int));
#define Width(im) (im->width) #endif
int Width(Image *im);
A Swig interface doesn’t need to match the C code.
• Can cut out unneeded parts.
• Play games with typedef and macros.
• Write helper functions.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
15. Advanced Features
Typemaps
• A technique for modifying Swig’s type handling.
Exception Handling
• Converting C/C++ errors into Perl errors.
Class and structure extension
• Adding new methods to structures and classes
• Building O-O interfaces to C programs.
This is going to be a whirlwind tour...
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
16. Typemap Example
Problem : Output values
void getsize(Image *im, int *w, int *h) {
*w = im->width;
*h = im->height;
}
Solution: Typemap library
%include typemaps.i
%apply int *OUTPUT { int *w, int *h };
...
void getsize(Image *im, int *w, int *h);
From Perl:
($w,$h) = getsize($im);
Note: There is a lot of underlying magic here (see docs).
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
17. Exception Handling
Problem : Converting C errors into Perl errors
int foo() {
...
throw Error;
...
};
Solution (place in an interface file):
%except(perl5) {
$function
if (Error) {
croak("You blew it!");
}
}
Exception code gets inserted into all of the wrappers.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
18. Class Extension
An interesting hack to attach methods to structs/classes
typedef struct {
int width;
int height;
...
} Image;
$im = new Image;
%addmethods Image { $im->plot(30,40,1);
Image(int w, int h) {
return CreateImage(w,h); print $im->{’width’};
} etc ...
~Image() {
free(self);
}
void plot(int x, int y, int c) {
ImagePlot(self,x,y,z);
}
...
}
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
19. Limitations
Parsing capability is limited
• Some types don’t work:
int (*func[10])(int, double);
int *const a;
int **&a;
• No macro expansion (Swig1.1)
• A number of advanced C++ features not supported.
Not all C/C++ code is easily scriptable
• Excessive complexity.
• Abuse of macros and templates.
Better integration with Perl
• Support for MakeMaker and other tools.
• Windows is still a bit of a mess.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
20. Future Plans
Swig1.1 is maintained, but is not the focus of development
• Daily maintenance builds at
http://swig.cs.uchicago.edu/SWIG
Swig2.0
• A major rewrite and reorganization of Swig.
• Primary goal is to make Swig more extensible.
Highlights
• Better parsing (new type system, preprocessing, etc...)
• Plugable components (code generators, parsers, etc...)
• Substantially improved code generation.
• Release date : TBA.
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999
21. Availability
Swig is free.
• www.swig.org (Primary)
• swig.cs.uchicago.edu (Development)
• CPAN
Compatibility
• Most versions of Perl (may need latest Swig however).
• Unix, Windows.
Acknowledgments
• David Fletcher, Dominique Dumont, and Gary Holt.
• Swig users who have contributed patches.
• University of Utah
• Los Alamos National Laboratory
O’Reilly Open Source Conference 3 0 - Swig - August 23 1999