cl-xml-cvs
Threads by month
- ----- 2026 -----
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 19 discussions
Author: ctian
Date: Tue Mar 22 02:17:32 2011
New Revision: 20
Log:
Created branch cl-xml-legacy. (saving the head to moving trunk forward to ASDF-based systems)
Added:
branches/legacy/
- copied from r19, /trunk/
1
0
[cl-xml-cvs] Is Israel a Democracy? -- The problem with intellectually insecure whites -- Should Christians Support Israeli Terrorism in Gaza?
by Lawrence Auster 23 Jan '09
by Lawrence Auster 23 Jan '09
23 Jan '09
The Jewish State of Israel has no constitution, nor does it name its borders. Israel's hidden constitution is Judaism. Israel's undeclared borders range from the Nile to the Euphrates rivers. Israel's desired jurisdiction extends over the entire Earth.
It could not be more clear that the Jewish State follows a foreign policy which obeys Jewish Law as iterated in the Hebrew Bible, the Talmud, Maimonedes, the Cabalah, and the many commentaries and refinements of same. The Jews are genociding the native inhabitants of Palestine, just as their religion advises, and because
their religion teaches them to do so. They treat non-Jews as if non-humans, just as their religion requires them to do. They make perpetual war on every nation on Earth, just as their genocidal Jewish God has instructed.
The Jews of Israel are simply being Jews. Jews are an existential threat to the human race.
Israel contains one third of the Jews of the World. It is not some aberration of the Jewish spirit, but the condensation and concentration of the perverse Jewish mentality, which malady also pervades the remaining two thirds of Jewry, who almost unanimously support the Jewish State, and who certainly do unanimously support
the Jewish People and its consistent and constant crimes against the human race. Israel is Jewry and the danger of Israel is the danger of the Jewish People to all others, as the Jews have demonstrated each and every day of their existence.
The Jews, the entire Jewish People of 15 million, will not relent until they have wiped out all non-Jews in "Greater Israel". They will not stop destroying all other cultures, nations, religions, ethnicities, races, competition, etc. until they are either stopped, or succeed in their ancient quest to destroy the human race.
What Israel is doing is not some reaction to outside forces, nor was the formation of Israel a response to the Holocaust. Israel is simply following the plan laid out in the Jews' religious texts. The Jews have openly planned to take Palestine and genocide the native population of Palestine for some 2,500 years before the
Holocaust. The Jews have openly complained that "anti-Semitism" is a threat that gives them the right to genocide the Palestinians, not merely since the advent of Nazism, but for some 2,500 years.
The Jewish religion is the Constitution of the Jewish State of Israel, and, to a greater or lesser extent, the constitution of the nature of every Jew alive. The borders of Israel are the range the Jew roams over the entire World. The perverse Jewish mentality is inbred by a Jew's exposure to his parents and to his community. Judaism
passes in the spit and slobber of Jewish mother telling her Jewish child that he is a "Jew", as much as Judaism passes in the poison and pain of a Talmudic tractate. The secular Jews did not suddenly come to life after the Enlightenment and the Jewish Reformation a body of vampires that appeared ex nihilo, in vacuo, mostly
atheistical and undetached from formally practiced Judaism. Judaism is the Jew. It is a mindset that transcends and supercedes religion. It is a belief set, a way of life, a perception of one's self and one's relation to the World that makes a Jew, a Jew, and a danger to all of humanity.
In fact, the religious shell of Judaism is like the stretched and infected skin of a lycanthropic pustule. When you lance it to cure the infection, the virus only becomes more contagious and spills directly on the non-Jew.
The secular Jew is a deliberate product of the hyper-religious Jew, a monster created out of the hewed corpses of the fanatically religious Jew, a Golem which is conjured up to enter the World of the non-Jew and poison its blood, and boil its brain with a rabid lunacy that bites and spreads, until the infected community feeds on
itself and fills the fields with rotting bloating bodies, where once human beings tilled the soil and tended to their families. The religious Jew created the secular Jew as an army of Esthers who seduce with open thighs, broad smiles, and a Siren call that lures in the non-Jew to cast his skull upon the jagged rocks and color the seas
with his blood, sickened and blinded by the venereal disease of Judaism in secular form.
Israel is not a secular democracy. It is a religious mockery. It is a rabid bat flying to the ends of the Earth, to end the Earth. No one will be free nor safe until the disease is quarantined and dies out.
Source: http://www.ziopedia.org/articles/israel/how_can_israel_claim_to_be_a_%27dem…
--------------------
The problem with intellectually insecure whites
By Kevin MacDonald
January 19, 2009
America will soon have a white minority. This is a much desired state of affairs for the hostile elites who hold political power and shape public opinion. But it certainly creates some management issues � at least in the long run. After all, it�s difficult to come up with an historical example of a nation with a solid ethnic majority (90%
white in 1950) that has voluntarily decided to cede political and cultural power. Such transformations are typically accomplished by military invasions, great battles, and untold suffering.
And it�s not as if everyone is doing it. Only Western nations view their own demographic and cultural eclipse as a moral imperative. Indeed, as I have noted previously, it is striking that racial nationalism has triumphed in Israel at the same time that the Jewish intellectual and political movements and the organized Jewish
community have been the most active and effective force for a non-white America. Indeed, a poll in 2008 found that Avigdor Lieberman was the second most popular politician in Israel. Lieberman has advocated expulsion of Arabs from Israel and has declared himself a follower of Vladimir Jabotinsky, the leading pioneer of racial
Zionism. The most popular politician in the poll was Benjamin Netanyahu � another admirer of Jabotinsky. Prime Minister Ehud Olmert and Foreign Minister Tzipi Livni are also Jabotinskyists.
The racial Zionists are now carrying out yet another orgy of mass murder after a starvation-inducing blockade and the usual triggering assault designed to provoke Palestinian retaliation � which then becomes the cover for claims that Israel is merely defending itself against terrorism. This monstrosity was approved by
overwhelming majorities of both Houses of Congress. The craven Bush administration did its part by abstaining from a UN resolution designed by the US Secretary of State as a result of a personal appeal by the Israeli Prime Minister. This is yet another accomplishment of the Israel Lobby, but one they would rather not have
discussed in public. People might get the impression that the Lobby really does dictate US foreign policy in the Mideast. Obviously, such thoughts are only entertained by anti-Semites.
But I digress.
In managing the eclipse of white America, one strategy of the mainstream media is to simply ignore the issue. Christopher Donovan (�For the media, the less whites think about their coming minority status, the better�) has noted that the media, and in particular, the New York Times, are quite uninterested in doing stories that
discuss what white people think about this state of affairs.
It�s not surprising that the New York Times � the Jewish-owned flagship of anti-white, pro-multicultural media � ignores the issue. The issue is also missing from so-called conservative media even though one would think that conservatives would find the eclipse of white America to be an important issue. Certainly, their audiences
would find it interesting.
Now we have an article �The End of White America� written by Hua Hsu, an Assistant Professor of English at Vassar College. The article is a rather depressing display of what passes for intellectual discourse on the most important question confronting white people in America.
Hsu begins by quoting a passage in F. Scott Fitzgerald�s The Great Gatsby in which a character, Tom Buchanan, states: �Have you read The Rise of the Colored Empires by this man Goddard?� � Well, it�s a fine book, and everybody ought to read it. The idea is if we don�t look out the white race will be�will be utterly submerged.
It�s all scientific stuff; it�s been proved.�
Buchanan�s comment is a thinly veiled reference to Lothrop Stoddard�s The Rising Tide of Color which Hsu describes as �rationalized hatred� presented in a scholarly, gentlemanly, and scientific tone. (This wording that will certainly help him when he comes up for tenure.) As Hsu notes, Stoddard had a doctorate from Harvard
and was a member of many academic associations. His book was published by a major publisher. It was therefore �precisely the kind of book that a 1920s man of Buchanan�s profile � wealthy, Ivy League�educated, at once pretentious and intellectually insecure � might have been expected to bring up in casual conversation.�
Let�s ponder that a bit. The simple reality is that in the year 2009 an Ivy League-educated person, "at once pretentious and intellectually insecure," would just as glibly assert the same sort of nonsense as Hsu. To wit:
The coming white minority does not mean that the racial hierarchy of American culture will suddenly become inverted, as in 1995�s White Man�s Burden, an awful thought experiment of a film, starring John Travolta, that envisions an upside-down world in which whites are subjugated to their high-class black oppressors. There will
be dislocations and resentments along the way, but the demographic shifts of the next 40 years are likely to reduce the power of racial hierarchies over everyone�s lives, producing a culture that�s more likely than any before to treat its inhabitants as individuals, rather than members of a caste or identity group.
The fact is that no one can say for certain what multicultural America without a white majority will be like. There is no scientific or historical basis for claims like �the demographic shifts of the next 40 years are likely to reduce the power of racial hierarchies over everyone�s lives, producing a culture that�s more likely than any before
to treat its inhabitants as individuals, rather than members of a caste or identity group.�
Indeed, there is no evidence at all that we are proceeding to a color blind future. The election results continue to show that white people are coalescing in the Republican Party, while the Democrats are increasingly the party of a non-white soon-to-be majority.
Is it so hard to believe that when this coalition achieves a majority that it will further compromise the interests of whites far beyond contemporary concerns such as immigration policy and affirmative action? Hsu anticipates a colorblind world, but affirmative action means that blacks and other minorities are certainly not treated as
individuals. And it means that whites � especially white males � are losing out on opportunities they would have had without these policies and without the massive non-white immigration of the last few decades.
Given the intractability of changing intelligence and other traits required for success in the contemporary economy, it is unlikely that 40 more years of affirmative action will attain the outcomes desired by the minority lobbies. Indeed, in Obama's America, blacks are rioting in Oakland over perceived racial injustices, and from 2002
�2007, black juvenile homicide victims increased 31%, while black juvenile homicide perpetrators increased 43%. Hence, the reasonable outlook is for a continuing need for affirmative action and for racial activism in these groups, even after whites become a minority.
Whites will also lose out because of large-scale importation of relatively talented immigrants from East Asia. Indeed, as I noted over a decade ago, "The United States is well on the road to being dominated by an Asian technocratic elite and a Jewish business, professional, and media elite."
Hsu shows that there already is considerable anxiety among whites about the future. An advertizing executive says, �I think white people feel like they�re under siege right now � like it�s not okay to be white right now, especially if you�re a white male. ... People are stressed out about it. �We used to be in control! We�re losing
control�� Another says, "There�s a lot of fear and a lot of resentment."
It's hard to see why these feelings won't increase in the future.
A huge problem for white people is lack of intellectual and cultural confidence. Hsu quotes Christian (Stuff White People Like) Lander saying, "I get it: as a straight white male, I�m the worst thing on Earth." A professor comments that for his students "to be white is to be culturally broke. The classic thing white students say when
you ask them to talk about who they are is, �I don�t have a culture.� They might be privileged, they might be loaded socioeconomically, but they feel bankrupt when it comes to culture � They feel disadvantaged, and they feel marginalized."
This lack of cultural confidence is no accident. For nearly 100 years whites have been subjected to a culture of critique emanating from the most prestigious academic and media institutions. And, as Hsu points out, the most vibrant and influential aspect of American popular culture is hip-hop�a product of the African American
urban culture.
The only significant group of white people with any cultural confidence centers itself around country music, NASCAR, and the small town values of traditional white America. For this group of whites � and only this group � there is "a racial pride that dares not speak its name, and that defines itself through cultural cues instead�a
suspicion of intellectual elites and city dwellers, a preference for folksiness and plainness of speech (whether real or feigned), and the association of a working-class white minority with 'the real America.'�
This is what I term implicit whiteness � implicit because explicit assertions of white identity have been banned by the anti-white elites that dominate our politics and culture. It is a culture that, as Hsu notes, "cannot speak its name."
But that implies that the submerged white identity of the white working class and the lack of cultural confidence exhibited by the rest of white America are imposed from outside. Although there may well be characteristics of whites that facilitate this process, this suppression of white identity and interests is certainly not the natural
outcome of modernization or any other force internal to whites as a people. In my opinion, it is the result of the successful erection of a culture of critique in the West dominated by Jewish intellectual and political movements.
The result is that educated, intellectually insecure white people these days are far more likely to believe in the utopian future described by Hsu than in hard and cautious thinking about what the future might have in store for them.
It's worth dwelling a bit on the intellectual insecurity of the whites who mindlessly utter the mantras of multiculturalism that they have soaked up from the school system and from the media. Most people do not have much confidence in their intellectual ability and look to elite opinion to shape their beliefs. As I noted elsewhere,
A critical component of the success of the culture of critique is that it achieved control of the most prestigious and influential institutions of the West, and it became a consensus among the elites, Jewish and non-Jewish alike. Once this happened, it is not surprising that this culture became widely accepted among people of very
different levels of education and among people of different social classes.
Most people are quite insecure about their intellectual ability. But they know that the professors at Harvard, and the editorial page of the New York Times and the Washington Post, and even conservative commentators like Rush Limbaugh and Sean Hannity are all on page when it comes to racial and ethnic issues. This is a
formidable array, to the point that you almost have to be a crank to dissent from this consensus.
I think one of the greatest triumphs of the left has been to get people to believe that people who assert white identity and interests or who make unflattering portrayals of organized Jewish movements are morally degenerate, stupid, and perhaps psychiatrically disturbed. Obviously, all of these adjectives designate low status.
The reality is that the multicultural emperor has no clothes and, because of its support for racial Zionism and the racialism of ethnic minorities in America, it is massively hypocritical to boot. The New York Times, the academic left, and the faux conservatives that dominate elite discourse on race and ethnicity are intellectually
bankrupt and can only remain in power by ruthlessly suppressing or ignoring the scientific findings.
This is particularly a problem for college-educated whites. Like Fitzgerald's Tom Buchanan, such people have a strong need to feel that their ideas are respectable and part of the mainstream. But the respectable mainstream gives them absolutely nothing with which to validate themselves except perhaps the idea that the world
will be a better place when people like them no longer have power. Hsu quotes the pathetic Christian Lander: "�Like, I�m aware of all the horrible crimes that my demographic has done in the world. ... And there�s a bunch of white people who are desperate � desperate � to say, �You know what? My skin�s white, but I�m not one
of the white people who�s destroying the world.��
As a zombie leftist during the 1960s and 1970s, I know what that feeling of desperation is like � what it's like to be a self-hating white. We must get to the point where college-educated whites proudly and confidently say they are white and that they do not want to become a minority in America.
This reminds me of the recent docudrama Milk, which depicts the life of gay activist Harvey Milk. Milk is sure be nominated for an Oscar as Best Picture because it lovingly illustrates a triumph of the cultural left. But is has an important message that should resonate with the millions of whites who have been deprived of their
confidence and their culture: Be explicit. Just as Harvey Milk advocated being openly gay even in the face of dire consequences, whites need to tell their family and their friends that they have an identity as a white person and believe that whites have legitimate interests as white people. They must accept the consequences
when they are harassed, fired from their jobs, or put in prison for such beliefs. They must run for political office as openly pro-white.
Milk shows that homosexuals were fired from their jobs and arrested for congregating in public. Now it's the Southern Poverty Law Center and the rest of the leftist intellectual and political establishment that harasses and attempts to get people fired. But it's the same situation with the roles reversed. No revolution was ever
accomplished without some martyrs. The revolution that restores the legitimacy of white identity and the legitimacy of white interests will be no exception.
But it is a revolution that is absolutely necessary. The white majority is foolish indeed to entrust its future to a utopian hope that racial and ethnic identifications will disappear and that they won�t continue to influence public policy in ways that compromise the interests of whites.
It does not take an overactive imagination to see that coalitions of minority groups could compromise the interests of formerly dominant whites. We already see numerous examples in which coalitions of minority groups attempt to influence public policy, including immigration policy, against the interests of the whites. Placing
ourselves in a position of vulnerability would be extremely risky, given the deep sense of historical grievance fostered by many ethnic activists and organized ethnic lobbies.
This is especially the case with Jews. Jewish organisations have been unanimous in condemning Western societies, Western traditions, and Christianity, for past crimes against Jews. Similar sentiments are typical of a great many African Americans and Latinos, and especially among the ethnic activists from these groups. The
�God damn America� sermon by President Obama's pastor comes to mind as a recent notorious example.
The precedent of the early decades of the Soviet Union should give pause to anyone who believes that surrendering ethnic hegemony does not carry risks. The Bolshevik revolution had a pronounced ethnic angle: To a very great extent, Jews and other non-Russians ruled over the Russian people, with disastrous
consequences for the Russians and other ethnic groups that were not able to become part of the power structure. Jews formed a hostile elite within this power structure � as they will in the future white-minority America; Jews were �Stalin�s willing executioners.�
Two passages from my review of Yuri Slezkine's The Jewish Century seem particularly appropriate here. The first passage reminds me of the many American Jews who adopt a veneer of support for leftist versions of social justice and racial tolerance while nevertheless managing to support racial Zionism and the mass murder,
torture, and incarceration of the Palestinian people in one of the largest prison systems the world has ever seen. Such people may be very different when they become a hostile elite in a white-minority America.
Many of the commentators on Jewish Bolsheviks noted the �transformation� of Jews [after the Bolshevik Revolution]. In the words of [a] Jewish commentator, G. A. Landau, �cruelty, sadism, and violence had seemed alien to a nation so far removed from physical activity.� And another Jewish commentator, Ia. A. Bromberg, noted
that:
the formerly oppressed lover of liberty had turned into a tyrant of �unheard-of-despotic arbitrariness��. The convinced and unconditional opponent of the death penalty not just for political crimes but for the most heinous offenses, who could not, as it were, watch a chicken being killed, has been transformed outwardly into a
leather-clad person with a revolver and, in fact, lost all human likeness. ...
After the Revolution, ... there was active suppression of any remnants of the older order and their descendants. ... The mass murder of peasants and nationalists was combined with the systematic exclusion of the previously existing non-Jewish middle class. The wife of a Leningrad University professor noted, �in all the
institutions, only workers and Israelites are admitted; the life of the intelligentsia is very hard� (p. 243). Even at the end of the 1930s, prior to the Russification that accompanied World War II, �the Russian Federation�was still doing penance for its imperial past while also serving as an example of an ethnicity-free society� (p. 276).
While all other nationalities, including Jews, were allowed and encouraged to keep their ethnic identities, the revolution remained an anti-majoritarian movement.
The difference from the Soviet Union may well be that in white-minority America it will not be workers and Israelites who are favored, but non-whites and Israelites. Whites may dream that they are entering the post-racial utopia imagined by their erstwhile intellectual superiors. But it is quite possible that they are entering into a
racial dystopia of unimaginable cruelty in which whites will be systematically excluded in favor of the new elites recruited from the soon-to-be majority. It's happened before.
Kevin MacDonald is a professor of psychology at California State University�Long Beach.
Permanent URL with hyperlinks:
http://www.theoccidentalobserver.net/articles/MacDonald-Hsu.html
-----------
Should Christians Support Israeli Terrorism in Gaza?
A timely discussion between Rev. Ted Pike and Dr. David Duke, one especially important for the Christians in our audience
http://www.davidduke.com/mp3/dukeradio090122DukeandPikeonGaza.mp3
In this vital discussion, Rev. Pike and Dr. Duke explore the Pro-Israel attitude of some Christian evangelical organizations, and why their position not only goes directly against Christian morality and decency, but actually is directly opposite of that expressed by Christian Scriptures. Today, Many Christians are instructed that Jews
and today�s Israel has a special covenant� with God. In fact, the New Testament in the clearest of language states that the Jews �continued not in my covenant, and I considered them not, saith the Lord.� Here�s the quote that Christians aren�t supposed to notice.:
8:10 Not according to the covenant that I made with their fathers, in the day when I took them by the hand out of the land of Egypt; because they continued not in my covenant, and I regarded them not, saith the Lord. (Hebrews 8:10)
They also don�t seem to notice that a 2000 year old Judaic war against Christianity that has been waged since time of Jesus Christ and still goes on today with the most powerful Jewish organizations attempting to destroy European and American traditions, that has even become a war on our Christmas traditions.
Dr. Duke and Ted Pike also speak about how over a hundred thousand Christian Palestinians have suffered with their families from anti-Christian Israel! Christian support of Israel has resulted in the very birthplace of Jesus Christ, go from 90 percent Palestinian Christians to 35 percent today because of Israeli terror and
occupation. They ask, �How could any Christian in good conscience support the anti-Christian state of Israel, bombing the homes, killing and maiming, torturing and oppressing fellow Christian men, women and children?�
This is a vital show for every Christian reader and listener of DavidDuke.com. Next time, you hear someone say, �God tells us that we must support Israel� you will have the clear Christian answer that just the opposite is true!
For documentation on this be sure to read some of the well-footnoted, sample chapters of Jewish Supremacism and My Awakening.
Source :
http://www.davidduke.com/general/should-christians-support-israeli-terroris…
-------------------------------------
You or someone using your email adress is currently subscribed to the Lawrence Auster
Newletter. If you wish to unsubscribe from our mailing list, please let us know by calling to 1 212 865 1284
Thanks,
Lawrence Auster,
238 W 101 St Apt. 3B
New York, NY 10025
Contact: lawrence.auster(a)att.net
-------------------------------------
1
0
Author: ctian
Date: Wed Nov 26 19:33:04 2008
New Revision: 19
Log:
trivial read-macro fixes for lispworks 5, let me do this before lost the access please
Modified:
trunk/code/atn-parser/clifs/inference-system-classes.lisp
trunk/code/atn-parser/clifs/inference-units.lisp
Modified: trunk/code/atn-parser/clifs/inference-system-classes.lisp
==============================================================================
--- trunk/code/atn-parser/clifs/inference-system-classes.lisp (original)
+++ trunk/code/atn-parser/clifs/inference-system-classes.lisp Wed Nov 26 19:33:04 2008
@@ -101,11 +101,11 @@
(setf (getf (system-plist system) indicator) value))
;; wg. CL-Konformitaet
-(defmethod documentation ((x inference-system) #-(or CMU LispWorks4 sbcl openmcl) &optional type)
+(defmethod documentation ((x inference-system) #-(or CMU LispWorks sbcl openmcl) &optional type)
(declare (ignore type))
(slot-value x 'doc))
-(defmethod (setf documentation) (doc (x inference-system) #-(or CMU LispWorks4 sbcl openmcl) &optional type)
+(defmethod (setf documentation) (doc (x inference-system) #-(or CMU LispWorks sbcl openmcl) &optional type)
(declare (ignore type))
(setf (slot-value x 'doc) doc))
Modified: trunk/code/atn-parser/clifs/inference-units.lisp
==============================================================================
--- trunk/code/atn-parser/clifs/inference-units.lisp (original)
+++ trunk/code/atn-parser/clifs/inference-units.lisp Wed Nov 26 19:33:04 2008
@@ -32,11 +32,11 @@
(documentation :accessor rule-documentation
:initarg :documentation)))
-(defmethod documentation ((x rule) #-(or CMU LispWorks4 sbcl openmcl) &optional doc-type)
+(defmethod documentation ((x rule) #-(or CMU LispWorks sbcl openmcl) &optional doc-type)
(declare (ignore doc-type))
(slot-value x 'documentation))
-(defmethod (setf documentation) (doc-string (x rule) #-(or CMU LispWorks4 sbcl openmcl) &optional doc-type)
+(defmethod (setf documentation) (doc-string (x rule) #-(or CMU LispWorks sbcl openmcl) &optional doc-type)
(declare (ignore doc-type))
(setf (slot-value x 'documentation) doc-string))
1
0
[cl-xml-cvs] r18 - in trunk: code code/base code/xparser code/xquerydatamodel documentation
by Chun Tian 26 Nov '08
by Chun Tian 26 Nov '08
26 Nov '08
Author: ctian
Date: Wed Nov 26 19:29:33 2008
New Revision: 18
Log:
Clean DS_Store files from repository ^_^
Removed:
trunk/code/.DS_Store
trunk/code/base/.DS_Store
trunk/code/xparser/.DS_Store
trunk/code/xquerydatamodel/.DS_Store
trunk/documentation/.DS_Store
1
0
Author: janderson
Date: Mon May 28 12:09:07 2007
New Revision: 17
Modified:
trunk/code/xparser/xml-stream-coding.lisp
Log:
several changes for runtime compatibility; corrections to coding functions; eol-> nl.
Modified: trunk/code/xparser/xml-stream-coding.lisp
==============================================================================
--- trunk/code/xparser/xml-stream-coding.lisp (original)
+++ trunk/code/xparser/xml-stream-coding.lisp Mon May 28 12:09:07 2007
@@ -1 +1,800 @@
-;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: xml-parser; -*-
#|
<DOCUMENTATION>
<DESCRIPTION>
<P>
this implementes stream readers which perform decoding/encoding in the case
of a binary stream. the correct decoder is selected by first examining the type of
input element which the stream will offer and the, in the case of binary streams,
by examining the initial byte sequence.
no attempt is made to distinguish the encoder based on the stream's class.
the detection methods return a reader function together with its argument, the
detected decoding and, where it is necessary to read an initial byte sequence, that
sequence as a string to be reread.
</P>
</DESCRIPTION>
<COPYRIGHT YEAR='2001' AUTHOR='james adam anderson' MARK='(C)'
href='file://xml/sysdcl.lisp' />
<CHRONOLOGY>
<DELTA DATE='20010328' AUTHOR='JAA'>
adapted from version 0.4*</DELTA>
<DELTA DATE='20010605' AUTHOR='MS'>
LispWorks conformance</DELTA>
<DELTA DATE='20010621'>added a method to encode UTF-8 for character streams</DELTA>
<DELTA DATE='20010907'>
<ul><li><code>*xml-verbose*</code></li>
<li>fixed incorrect decoding for re-read sequence by recognized UTF-1612/21 BOM</li></ul></DELTA>
<DELTA DATE='20010914'>provisional us-ascii encoding method</DELTA>
<DELTA DATE='20020118'>corrections to encoding-stream-writer for non-mcl;
fixed autodetect code to recognize allegro :EOF; fixed us-ascii stream-reader for same.</DELTA>
<DELTA DATE='20030602'>provisioins for allegro simple-streams with character element-type</DELTA>
</CHRONOLOGY>
</DOCUMENTATION>
|#
(in-package "XML-PARSER")
#+(or ALLEGRO LispWorks CormanLisp CMU sbcl)
(defMacro lsh (x y) `(ash ,x ,y))
#+(and allegro allegro-version>= (not (version>= 6 0)))
(progn
;; acl 5.0 versions
(defMethod stream-reader ((stream excl:fundamental-character-input-stream))
(let ((methods (compute-applicable-methods #'excl:stream-read-char (list stream))))
(values (if (= (length methods) 1)
(clos:method-function (first methods))
#'(lambda (arg)
(setf arg (excl:stream-read-char arg))
(unless (eq arg :eof) arg)))
stream)))
(defMethod stream-reader ((stream excl:fundamental-binary-input-stream))
(let ((methods (compute-applicable-methods #'excl:stream-read-byte (list stream))))
(values (if (= (length methods) 1)
(clos:method-function (first methods))
#'(lambda (arg)
(setf arg (excl:stream-read-byte arg))
(unless (eq arg :eof) arg)))
stream)))
(defMethod stream-writer ((stream excl:fundamental-character-output-stream))
(let ((methods (compute-applicable-methods #'excl:stream-write-char (list stream))))
(values (if (= (length methods) 1)
(clos:method-function (first methods))
#'excl:stream-write-char)
stream)))
(defMethod stream-writer ((stream excl:fundamental-binary-output-stream))
(let ((methods (compute-applicable-methods #'excl:stream-write-byte (list stream))))
(values (if (= (length methods) 1)
(clos:method-function (first methods))
#'excl:stream-write-byte)
stream)))
;; end acl5.0 versions
)
#+(and allegro allegro-version>= (version>= 6 0))
(progn
;; originally allegro 6.0 version
(defmethod stream-reader ((stream excl:fundamental-stream))
(values #'(lambda (stream) (read-byte stream nil nil))
stream))
(defmethod stream-writer ((stream excl:fundamental-stream))
(values #'(lambda (stream byte) (write-byte byte stream))
stream))
;; originally allegro 6.1 version; Bob Rogers <rogers(a)rgrjr.dyndns.org> remarked, that
;; they're present in 6.0 as well
(defmethod stream-reader ((stream excl:simple-stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream) (read-char stream nil nil))
#'(lambda (stream) (read-byte stream nil nil)))
stream))
(defMethod stream-writer ((stream excl:simple-stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream char) (write-char char stream))
#'(lambda (stream byte) (write-byte byte stream)))
stream))
)
#+LispWorks
(defMethod stream-reader ((stream stream:fundamental-stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream) (read-char stream nil nil))
#'(lambda (stream) (read-byte stream nil nil)))
stream))
#+LispWorks
(defMethod stream-writer ((stream stream:fundamental-stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream char) (write-char char stream))
#'(lambda (stream byte) (write-byte byte stream)))
stream))
#+CormanLisp
(defMethod stream-reader ((stream stream:fundamental-stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream)
(read-char stream nil nil))
#'(lambda (stream)
(read-byte stream nil nil)))
stream))
#+CormanLisp
(defMethod stream-writer ((stream stream:fundamental-stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream char)
(write-char char stream))
#'(lambda (stream byte)
(write-byte byte stream)))
stream))
#+(and mcl (not digitool))
(defMethod stream-reader ((stream fundamental-stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream)
(read-char stream nil nil))
#'(lambda (stream)
(read-byte stream nil nil)))
stream))
#+(and mcl (not digitool))
(defMethod stream-writer ((stream fundamental-stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream char)
(write-char char stream))
#'(lambda (stream byte)
(write-byte byte stream)))
stream))
#+CMU
(defmethod stream-element-type ((stream stream))
; (cl::fd-stream-element-type stream)
'(unsigned-byte 8))
#+CMU
(defMethod stream-reader ((stream stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream)
(read-char stream nil nil))
#'(lambda (stream)
(read-byte stream nil nil)))
stream))
#+CMU
(defMethod stream-writer ((stream stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream char)
(write-char char stream))
#'(lambda (stream byte)
(write-byte byte stream)))
stream))
#+sbcl
(defmethod stream-element-type ((stream stream))
; (cl::fd-stream-element-type stream)
'(unsigned-byte 8))
#+sbcl
(defMethod stream-reader ((stream stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream)
(read-char stream nil nil))
#'(lambda (stream)
(read-byte stream nil nil)))
stream))
#+sbcl
(defMethod stream-writer ((stream stream))
(values (if (subtypep (stream-element-type stream) 'character)
#'(lambda (stream char)
(write-char char stream))
#'(lambda (stream byte)
(write-byte byte stream)))
stream))
;; adapted from cl-http:mcl;server;tcp-ot-stream for the strictly binary case
;; the first case comes into play without cl-http. connections are made with a simple tcp stream
;; the second case takes into account, that chunking decoding extends the generic function
#+(and mcl mactcp-compatibility)
(defMethod stream-reader ((stream ccl::binary-tcp-stream))
(values #'ccl::io-buffer-read-byte (ccl::stream-io-buffer stream)))
#+(and MCL CL-HTTP)
(defmethod stream-reader ((stream ccl::modal-ascii-or-binary-tcp-stream-mixin))
(values (case (ccl::input-mode stream)
(:ascii #'stream-tyi)
((:binary nil)
(let ((method-combination (ccl::generic-function-method-combination #'ccl::stream-read-byte))
(methods (compute-applicable-methods #'ccl::stream-read-byte (list stream))))
(ccl::compute-effective-method-function #'ccl::stream-read-byte
method-combination
methods))))
stream))
#+(and mcl mactcp-compatibility)
(defmethod stream-writer ((stream ccl::binary-tcp-stream))
(flet ((io-buffer-tyo-byte (io-buffer byte)
;; ? not sure that continuability is a good idea, but
(unless (typep io-buffer 'ccl::io-buffer)
(setq io-buffer (require-type io-buffer 'ccl::io-buffer)))
(if (characterp byte) (setf byte (char-code byte)))
(ccl::%io-buffer-write-byte io-buffer byte)))
(values #'io-buffer-tyo-byte (ccl::stream-io-buffer stream))))
#+(and mcl mactcp-compatibility)
(defMethod stream-element-type ((stream ccl::binary-tcp-stream))
;; mcl 4.2 yielded BASE-CHARACTER for this class and produced a character reader ...?
'unsigned-byte)
;; determine whether the stream supports binary operations
(defGeneric is-binary-stream (stream)
#-allegro
(:method ((stream stream)) (subtypep (stream-element-type stream) 'unsigned-byte))
;; allegro 6 "simple streams" can always do the byte operations
#+allegro
(:method ((stream string-stream)) nil)
#+allegro
(:method ((stream stream))
#+(and allegro-version>= (version>= 6 0)) t
#+(and allegro-version>= (not (version>= 6 0))) (subtypep (stream-element-type stream) 'unsigned-byte)
))
(defGeneric decoding-stream-reader (stream encoding)
(:method ((stream stream) (encoding null))
(decoding-stream-reader stream (stream-element-type stream)))
(:method ((stream stream) (type cons))
(decoding-stream-reader stream (first type)))
(:method ((stream stream) (encoding string) &aux canonical-encoding)
(cond ((setf canonical-encoding (canonical-encoding encoding))
(when *xml-verbose*
(warn "assuming ~a encoding for stream: ~s." canonical-encoding stream))
(decoding-stream-reader stream canonical-encoding))
(t
(warn "no decoding defined for operation on stream: ~s: ~s." stream encoding)
(values nil nil encoding))))
(:method ((stream stream) (encoding symbol) &aux canonical-encoding)
(cond ((setf canonical-encoding (canonical-encoding encoding))
(when *xml-verbose*
(warn "assuming ~a encoding for stream: ~s." canonical-encoding stream))
(decoding-stream-reader stream canonical-encoding))
((subtypep encoding 'integer)
(decoding-stream-reader stream :autodetect))
((subtypep encoding 'character)
(decoding-stream-reader stream *default-character-encoding*))
(t
(warn "no decoding defined for operation on stream: ~s: ~s." stream encoding)
(values nil nil encoding)))))
(defGeneric encoding-stream-writer (stream encoding)
(:method ((stream t) (encoding t))
(warn "no decoding defined for operation on stream: ~s: ~s." encoding stream)
(values nil nil))
(:method ((stream stream) (encoding null) &aux (type (stream-element-type stream)))
(unless type
(warn "assuming element type character for stream: ~s." stream)
(setf type 'character))
(encoding-stream-writer stream type))
(:method ((stream stream) (type cons))
(encoding-stream-writer stream (first type)))
(:method ((stream stream) (encoding string) &aux canonical-encoding)
(cond ((setf canonical-encoding (canonical-encoding encoding))
(when *xml-verbose*
(warn "assuming ~a encoding for stream: ~s." canonical-encoding stream))
(encoding-stream-writer stream canonical-encoding))
(t
(warn "no decoding defined for operation on stream: ~s: ~s." stream encoding)
(values nil nil encoding))))
(:method ((stream stream) (encoding symbol) &aux canonical-encoding)
(cond ((setf canonical-encoding (canonical-encoding encoding))
(when *xml-verbose*
(warn "assuming ~a encoding for stream: ~s." canonical-encoding stream))
(encoding-stream-writer stream canonical-encoding))
((subtypep encoding 'integer)
(encoding-stream-writer stream *default-binary-encoding*))
((subtypep encoding 'character)
(encoding-stream-writer stream *default-character-encoding*))
(t
(warn "no encoding defined for operation on stream: ~s: ~s." stream encoding)
(values nil nil encoding)))))
(defMacro funcall-function.arg (function.arg &rest args)
`(funcall (first ,function.arg) (rest ,function.arg) ,@args))
(defun change-stream-decoding (new-encoding)
(etypecase new-encoding
(keyword t)
((or string (and symbol (not null)))
(setf new-encoding (intern (string-upcase new-encoding) "KEYWORD"))))
(if (or (eq new-encoding *input-encoding*)
(and (eq new-encoding :utf-16)
(member *input-encoding* '(:utf-16-12 :utf-16-21))))
(values *input-encoding* nil)
(multiple-value-bind (function arg detected-encoding to-reread)
(decoding-stream-reader *input-source* new-encoding)
(unless (and (eq detected-encoding new-encoding)
(null to-reread))
(error "can't change encoding: ~s: ~s -> ~s = ~s/~s."
*input-source*
*input-encoding* new-encoding detected-encoding to-reread))
(unless function (error "no reader for encoding: ~s." new-encoding))
(setf *input-reader* function
*input-reader-arg* arg
*input-encoding* new-encoding)
;; return the new encoding
(values new-encoding t))))
;;
;;
;; UTF-8 is computed
(defMethod decoding-stream-reader
((stream stream) (encoding (eql :UTF-8)))
(unless (is-binary-stream stream)
(warn "stream type not compatible with encoding: ~s: ~s."
(stream-element-type stream) encoding))
(multiple-value-bind (function arg)
(stream-reader stream)
(values #'(lambda (function.arg &aux byte1)
(block read-utf-8-datum
(flet ((read-byte-code (&aux byte)
(setf byte (funcall-function.arg function.arg))
(if (integerp byte) byte
(return-from read-utf-8-datum nil))))
(declare (type fixnum byte1)
(ftype (function () fixnum) read-byte-code)
(optimize (speed 3) (safety 0)))
(setf byte1 (read-byte-code))
(cond ((= 0 (logand #x80 byte1))
byte1)
((= #xc0 (logand #xe0 byte1))
(logior (lsh (logand byte1 #x1f) 6)
(logand (read-byte-code) #x3f)))
((= #xe0 (logand #xf0 byte1))
(logior (logior (lsh (logand byte1 #x0f) 12)
(lsh (logand (read-byte-code) #x3f) 6))
(logand (read-byte-code) #x3f)))
((= #xf0 (logand #xf8 byte1))
(let ((byte2 (read-byte-code))
(byte3 (read-byte-code))
(byte4 (read-byte-code)))
(xml-error "unsupported unicode datum: ~s."
(list byte1 byte2 byte3 byte4))))
(t
(xml-error "illegal UTF-8 data: x~2,'0x." byte1))))))
(cons function arg)
:UTF-8)))
(defMethod encoding-stream-writer
((stream stream) (encoding (eql :UTF-8)))
(if (is-binary-stream stream)
(multiple-value-bind (function arg)
(stream-writer stream)
(values #'(lambda (function.arg char &aux (code (char-code char)))
(cond ((<= code 255)
(funcall-function.arg function.arg code))
((<= code #x03ff)
(funcall-function.arg function.arg (logior #b11000000 (lsh code -6)))
(funcall-function.arg function.arg (logior #b10000000 (logand code #b00111111))))
((<= code #xffff)
(funcall-function.arg function.arg (logior #b11100000 (lsh code -12)))
(funcall-function.arg function.arg (logior #b10000000 (logand (lsh code -6) #b00111111)))
(funcall-function.arg function.arg (logior #b10000000 (logand code #b00111111))))
(t
(xml-error "unsupported unicode datum: ~s." code))))
(cons function arg)))
(multiple-value-bind (function arg)
(stream-writer stream)
(values #'(lambda (function.arg char &aux (code (char-code char)))
(cond ((<= code 255)
(funcall-function.arg function.arg char))
(t
(let ((string (format nil "&#~d" code)))
(dotimes (x (length string))
(funcall-function.arg function.arg (char string x)))))))
(cons function arg)))))
;;
;;
;; ISO-8859-1 is direct
(defMethod decoding-stream-reader
((stream stream) (encoding (eql :ISO-8859-1)))
(multiple-value-bind (function arg)
(stream-reader stream)
(if (is-binary-stream stream)
#-(or MCL LispWorks)
(multiple-value-bind (reader arg)
(stream-reader stream)
(values #'(lambda (function.arg &aux byte)
(setf byte (funcall-function.arg function.arg))
(when (integerp byte) byte))
(cons reader arg)
encoding))
#+(or MCL LispWorks)
(values function arg encoding)
;; character streams must be mapped back to binary
(values #'(lambda (function.arg &aux char)
(setf char (funcall-function.arg function.arg))
(when (characterp char)
;; hardcore tracing
;; (write-char char *trace-output*)
(char-code char)))
(cons function arg)
encoding))))
(defMethod decoding-stream-reader
((stream stream) (encoding (eql :US-ASCII)))
(multiple-value-bind (function arg)
(stream-reader stream)
(if (is-binary-stream stream)
#-(or MCL LispWorks)
(multiple-value-bind (reader arg)
(stream-reader stream)
(values #'(lambda (function.arg &aux byte)
(setf byte (funcall-function.arg function.arg))
(when (integerp byte) byte))
(cons reader arg)
encoding))
#+(or MCL LispWorks)
(values function arg encoding)
;; character streams must be mapped back to binary
(values #'(lambda (function.arg &aux char)
(setf char (funcall-function.arg function.arg))
(when (characterp char)
(char-code char)))
(cons function arg)
encoding))))
#+digitool ;; fix eol
(defMethod encoding-stream-writer
((stream stream) (encoding (eql :ISO-8859-1)))
(multiple-value-bind (function arg)
(stream-writer stream)
(if (is-binary-stream stream)
(values #'(lambda (function.arg char)
(funcall-function.arg function.arg
(if (= (char-code char) #x0a)
#x0d
(char-code char))))
(cons function arg)
encoding)
(values #'(lambda (function.arg char)
(funcall-function.arg function.arg
(if (= (char-code char) #x0a)
#.(code-char #x0d)
char)))
(cons function arg)
encoding))))
#-digitool
(defMethod encoding-stream-writer
((stream stream) (encoding (eql :ISO-8859-1)))
(if (is-binary-stream stream)
(multiple-value-bind (function arg)
(stream-writer stream)
(values #'(lambda (function.arg char)
(funcall-function.arg function.arg (char-code char)))
(cons function arg)
encoding))
(multiple-value-bind (function arg)
(stream-writer stream)
(values function arg encoding))))
(defMethod encoding-stream-writer
((stream stream) (encoding (eql :US-ASCII)))
(multiple-value-bind (function arg)
(stream-writer stream)
#+digitool
(if (is-binary-stream stream)
(values #'(lambda (function.arg char)
(funcall-function.arg function.arg
(if (= (char-code char) #x0a)
#x0d
(char-code char))))
(cons function arg)
encoding)
(values #'(lambda (function.arg char)
(funcall-function.arg function.arg
(if (= (char-code char) #x0a)
#.(code-char #x0d)
char)))
(cons function arg)
encoding))
#-digitool
(if (is-binary-stream stream)
(values #'(lambda (function.arg char)
(funcall-function.arg function.arg (char-code char)))
(cons function arg)
encoding)
(values function arg encoding))))
;;
;;
;; UTF-16 distinguishes encoding order:
;; UTF-16LE is UTF16 in "little-endian" byte order. (order mark is 0xFF 0xFE)
;; UTF-16BE is UTF16 in "big-endian" byte order. (order mark is 0xFE 0xFF)
(defMethod decoding-stream-reader
((stream stream) (encoding (eql :UTF-16)))
(decoding-stream-reader stream *default-utf-16-encoding*))
(defMethod encoding-stream-writer
((stream stream) (encoding (eql :UTF-16)))
(encoding-stream-writer stream *default-utf-16-encoding*))
(defMethod decoding-stream-reader
((stream stream) (encoding (eql :UTF-16-12)))
(unless (is-binary-stream stream)
(warn "stream type not compatible with encoding: ~s: ~s."
(stream-element-type stream) encoding))
(multiple-value-bind (function arg)
(stream-reader stream)
(values #'(lambda (function.arg)
(declare (ftype (function () fixnum) read-byte-code)
(optimize (speed 3) (safety 0)))
(block read-utf-16-datum
(flet ((read-byte-code (&aux byte)
(setf byte (funcall-function.arg function.arg))
(if (integerp byte) byte
(return-from read-utf-16-datum nil))))
(+ (lsh (read-byte-code) 8) (read-byte-code)))))
(cons function arg)
encoding)))
(defMethod encoding-stream-writer
((stream stream) (encoding (eql :UTF-16-12)))
(unless (is-binary-stream stream)
(warn "stream type not compatible with encoding: ~s: ~s."
(stream-element-type stream) encoding))
(multiple-value-bind (function arg)
(stream-writer stream)
(values #'(lambda (function.arg datum)
(setf datum (char-code datum))
(funcall-function.arg function.arg (logand #xff (lsh datum -8)))
(funcall-function.arg function.arg (logand #xff datum)))
(cons function arg))))
(defMethod decoding-stream-reader
((stream stream) (encoding (eql :UTF-16-21)))
(unless (is-binary-stream stream)
(warn "stream type not compatible with encoding: ~s: ~s."
(stream-element-type stream) encoding))
(multiple-value-bind (function arg)
(stream-reader stream)
(values #'(lambda (function.arg)
(declare (ftype (function () fixnum) read-byte-code)
(optimize (speed 3) (safety 0)))
(block read-utf-16-datum
(flet ((read-byte-code (&aux byte)
(setf byte (funcall-function.arg function.arg))
(if (integerp byte) byte
(return-from read-utf-16-datum nil))))
(+ (read-byte-code) (lsh (read-byte-code) 8)))))
(cons function arg)
encoding)))
(defMethod encoding-stream-writer
((stream stream) (encoding (eql :UTF-16-21)))
(unless (is-binary-stream stream)
(warn "stream type not compatible with encoding: ~s: ~s."
(stream-element-type stream) encoding))
(multiple-value-bind (function arg)
(stream-writer stream)
(values #'(lambda (function.arg datum)
(setf datum (char-code datum))
(funcall-function.arg function.arg (logand #xff datum))
(funcall-function.arg function.arg (logand #xff (lsh datum -8))))
(cons function arg))))
;;
;;
;; detect encoding by reading the initial content. works for binary streams only
(defMethod decoding-stream-reader
((stream stream) (encoding (eql :autodetect)) &aux byte0 byte1 to-reread)
"see PR-xml Appendix F"
(multiple-value-bind (reader arg) (stream-reader stream)
(flet ((next-byte (&aux (byte (funcall reader arg)))
(typecase byte
(fixnum byte)
(t nil))))
(case (setf byte0 (next-byte))
(#x00 (case (next-byte)
(#x00 (case (next-byte)
(#x3c (if (= (next-byte) #x00)
(setf encoding :UCS-4-2143 to-reread "<")
(error "markup stream corrupt: ~s." stream)))
(#x00 (if (= (next-byte) #x3c)
(setf encoding :UCS-4-1234 to-reread "<")
(error "markup stream corrupt: ~s." stream)))
(#xFE (if (= (next-byte) #xFF)
(setf encoding :UCS-4-1234 to-reread nil)
(error "markup stream corrupt: ~s." stream)))
(#xFF (if (= (next-byte) #xFE)
(setf encoding :UCS-4-2143 to-reread nil)
(error "markup stream corrupt: ~s." stream)))
(t (error "markup stream corrupt: ~s." stream))))
(#x3c (if (= (setf byte1 (next-byte)) #x00)
(case (setf byte1 (next-byte))
(#x00 (setf encoding :UCS-4-3412 to-reread "<"))
(#x3f
(when *xml-verbose*
(warn "assuming UTF-16-21 encoding for stream: ~s." stream))
(setf encoding :UTF-16-21 to-reread "<?"))
(t (|EC: Byte Order Mark| :data (list #x00 #x3c #x00 byte1))))
(|EC: Byte Order Mark| :data (list #x00 #x3c byte1))))
(t
(error "markup stream corrupt: ~s." stream))))
(#x3c (case (setf byte1 (next-byte))
(#x00 (case (setf byte1 (next-byte))
(#x3f (case (setf byte1 (next-byte))
(#x00
(when *xml-verbose*
(warn "assuming UTF-16-12 encoding for stream: ~s." stream))
(setf encoding :UTF-16-12 to-reread "<?"))
(t
(|EC: Byte Order Mark| :data (list #x3c #x00 #x3f byte1)))))
(#x00 (if (= (next-byte) #x00)
(setf encoding :UCS-4-4321 to-reread "<")
(|EC: Byte Order Mark| :data (list #x3c #x00 #x00 byte1))))
(t
(|EC: Byte Order Mark| :data (list #x3c #x00 byte1)))))
(#x3f (setf encoding *default-binary-encoding* to-reread "<?"))
(t
(unless (or (xml-initial-namechar? byte1) (= byte1 #.(char-code #\!)))
(when *xml-verbose*
(warn "assuming UTF-8 encoding for stream: ~s." stream)))
(setf encoding *default-binary-encoding* to-reread (list byte0 byte1)))))
(#xEF (case (setf byte1 (next-byte))
(#xBB (if (= (setf byte1 (next-byte)) #xBF)
(setf encoding :UTF-8 to-reread nil)
(|EC: Byte Order Mark| :data (list #xEF #xBB byte1))))
(t
(|EC: Byte Order Mark| :data (list #xEF byte1)))))
(#xff
(if (= (setf byte1 (next-byte)) #xfe)
(let ((byte2 (next-byte)) (byte3 (next-byte)))
(if (and (= byte2 0) (= byte3 0))
(setf encoding :UCS4-4321 to-reread nil)
(setf encoding :UTF-16-21 to-reread (list (+ byte2 (lsh byte3 8))))))
(|EC: Byte Order Mark| :data (list #xff byte1))))
(#xfe
(if (= (setf byte1 (next-byte)) #xff)
(let ((byte2 (next-byte)) (byte3 (next-byte)))
(if (and (= byte2 0) (= byte3 0))
(setf encoding :UCS4-3412 to-reread nil)
(setf encoding :UTF-16-12 to-reread (list (+ (lsh byte2 8) byte3)))))
(|EC: Byte Order Mark| :data (list #xfe byte1))))
((nil) ;; no data in stream
(setf encoding :UTF-8 to-reread nil))
(t
(when *xml-verbose*
(warn "assuming UTF-8 encoding for stream: ~s." stream))
(setf encoding :UTF-8 to-reread (list byte0))))
(multiple-value-bind (reader arg encoding) (decoding-stream-reader stream encoding)
(values reader arg encoding to-reread)))))
#|
(defun utf-8-decoding (byte1 &optional (byte2 0) (byte3 0) (byte4 0))
(cond ((= 0 (logand #x80 byte1))
byte1)
((= #xc0 (logand #xe0 byte1))
(logior (lsh (logand byte1 #x1f) 6) (logand byte2 #x3f)))
((= #xe0 (logand #xf0 byte1))
(logior (logior (lsh (logand byte1 #x0f) 12) (lsh (logand byte2 #x3f) 6)) (logand byte3 #x3f)))
((= #xf0 (logand #xf8 byte1))
(xml-error "unsupported unicode datum: ~s."
(list byte1 byte2 byte3 byte4)))
(t
(xml-error "illegal UTF-8 data: #x~2,'0x." byte1))))
(xml-namechar? (utf-8-decoding 194 183 0 0))
(xml-space? (utf-8-decoding 239 187 191))
(apply #'utf-8-decoding (map 'list #'char-code "༤"))
(defun utf-8-decodingXstring (string)
(handler-case
(apply #'utf-8-decoding (map 'list #'char-code string))
(error (condition) (format nil "~s(~{~2,'0x~}) -> ~a"
string (map 'list #'char-code string)
condition))))
(format nil "~{~8,'0x~^~%~}" (mapcar #'utf-8-decodingXstring
'("" "氏" "" "�" "�")))
from the 3.1 unicode report
Table 3.1.
UTF-8 Bit Distribution
Scalar Value UTF-16 1st Byte 2nd Byte 3rd Byte 4th Byte
00000000 0xxxxxxx 00000000 0xxxxxxx 0xxxxxxx
00000yyy yyxxxxxx 00000yyy yyxxxxxx 110yyyyy 10xxxxxx
zzzzyyyy yyxxxxxx zzzzyyyy yyxxxxxx 1110zzzz 10yyyyyy 10xxxxxx
000uuuuu zzzzyyyy 110110ww wwzzzzyy 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx
yyxxxxxx 110111yy yyxxxxxx
Where uuuuu = wwww + 1 (to account for addition of 1000016 as in Section 3.7, Surrogates).
|#
:EOF
\ No newline at end of file
+;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: xml-parser; -*-
+
+
+#|
+<DOCUMENTATION>
+ <DESCRIPTION>
+ <P>
+ this implementes stream readers which perform decoding/encoding in the case
+ of a binary stream. the correct decoder is selected by first examining the type of
+ input element which the stream will offer and the, in the case of binary streams,
+ by examining the initial byte sequence.
+ no attempt is made to distinguish the encoder based on the stream's class.
+ the detection methods return a reader function together with its argument, the
+ detected decoding and, where it is necessary to read an initial byte sequence, that
+ sequence as a string to be reread.
+ </P>
+ </DESCRIPTION>
+ <COPYRIGHT YEAR='2001' AUTHOR='james adam anderson' MARK='(C)'
+ href='file://xml/sysdcl.lisp' />
+ <CHRONOLOGY>
+ <DELTA DATE='20010328' AUTHOR='JAA'>
+ adapted from version 0.4*</DELTA>
+ <DELTA DATE='20010605' AUTHOR='MS'>
+ LispWorks conformance</DELTA>
+ <DELTA DATE='20010621'>added a method to encode UTF-8 for character streams</DELTA>
+ <DELTA DATE='20010907'>
+ <ul><li><code>*xml-verbose*</code></li>
+ <li>fixed incorrect decoding for re-read sequence by recognized UTF-1612/21 BOM</li></ul></DELTA>
+ <DELTA DATE='20010914'>provisional us-ascii encoding method</DELTA>
+ <DELTA DATE='20020118'>corrections to encoding-stream-writer for non-mcl;
+ fixed autodetect code to recognize allegro :EOF; fixed us-ascii stream-reader for same.</DELTA>
+ <DELTA DATE='20030602'>provisions for allegro simple-streams with character element-type</DELTA>
+ <DELTA DATE='20030602'>scl</DELTA>
+ <DELTA DATE='20040123'>correction to utf-16-{21,12} order discovered from initial declaration
+ bytes rather than from BOM.</DELTA>
+ <DELTA DATE='20060116'>lsh ccl-specific</DELTA>
+ <DELTA DATE='20070415'>corrected utf-8 encoding bounds.</DELTA>
+ </CHRONOLOGY>
+ </DOCUMENTATION>
+|#
+
+(in-package "XML-PARSER")
+
+(defvar *illegal-utf-data-condition* nil)
+
+#+(or ALLEGRO LispWorks CormanLisp CMU sbcl scl)
+(defMacro lsh (x y) `(ash ,x ,y))
+
+#+ccl
+(unless (eq (symbol-package 'lsh) (find-package :ccl))
+ (defmacro lsh (x y) `(ccl:lsh ,x ,y)))
+
+#+(and allegro allegro-version>= (not (version>= 6 0)))
+(progn
+ ;; acl 5.0 versions
+
+ (defMethod stream-reader ((stream excl:fundamental-character-input-stream))
+ (let ((methods (compute-applicable-methods #'excl:stream-read-char (list stream))))
+ (values (if (= (length methods) 1)
+ (clos:method-function (first methods))
+ #'(lambda (arg)
+ (setf arg (excl:stream-read-char arg))
+ (unless (eq arg :eof) arg)))
+ stream)))
+
+ (defMethod stream-reader ((stream excl:fundamental-binary-input-stream))
+ (let ((methods (compute-applicable-methods #'excl:stream-read-byte (list stream))))
+ (values (if (= (length methods) 1)
+ (clos:method-function (first methods))
+ #'(lambda (arg)
+ (setf arg (excl:stream-read-byte arg))
+ (unless (eq arg :eof) arg)))
+ stream)))
+
+ (defMethod stream-writer ((stream excl:fundamental-character-output-stream))
+ (let ((methods (compute-applicable-methods #'excl:stream-write-char (list stream))))
+ (values (if (= (length methods) 1)
+ (clos:method-function (first methods))
+ #'excl:stream-write-char)
+ stream)))
+
+ (defMethod stream-writer ((stream excl:fundamental-binary-output-stream))
+ (let ((methods (compute-applicable-methods #'excl:stream-write-byte (list stream))))
+ (values (if (= (length methods) 1)
+ (clos:method-function (first methods))
+ #'excl:stream-write-byte)
+ stream)))
+ ;; end acl5.0 versions
+ )
+
+#+(and allegro allegro-version>= (version>= 6 0))
+(progn
+ ;; originally allegro 6.0 version
+ (defmethod stream-reader ((stream excl:fundamental-stream))
+ (values #'(lambda (stream) (read-byte stream nil nil))
+ stream))
+ (defmethod stream-writer ((stream excl:fundamental-stream))
+ (values #'(lambda (stream byte) (write-byte byte stream))
+ stream))
+
+
+ ;; originally allegro 6.1 version; Bob Rogers <rogers(a)rgrjr.dyndns.org> remarked, that
+ ;; they're present in 6.0 as well
+ (defmethod stream-reader ((stream excl:simple-stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream) (read-char stream nil nil))
+ #'(lambda (stream) (read-byte stream nil nil)))
+ stream))
+ (defMethod stream-writer ((stream excl:simple-stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream char) (write-char char stream))
+ #'(lambda (stream byte) (write-byte byte stream)))
+ stream))
+ )
+
+#+LispWorks
+(defMethod stream-reader ((stream stream:fundamental-stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream) (read-char stream nil nil))
+ #'(lambda (stream) (read-byte stream nil nil)))
+ stream))
+#+LispWorks
+(defMethod stream-writer ((stream stream:fundamental-stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream char) (write-char char stream))
+ #'(lambda (stream byte) (write-byte byte stream)))
+ stream))
+
+#+CormanLisp
+(defMethod stream-reader ((stream stream:fundamental-stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream)
+ (read-char stream nil nil))
+ #'(lambda (stream)
+ (read-byte stream nil nil)))
+ stream))
+#+CormanLisp
+(defMethod stream-writer ((stream stream:fundamental-stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream char)
+ (write-char char stream))
+ #'(lambda (stream byte)
+ (write-byte byte stream)))
+ stream))
+
+#+(and mcl (not digitool))
+(defMethod stream-reader ((stream fundamental-stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream)
+ (read-char stream nil nil))
+ #'(lambda (stream)
+ (read-byte stream nil nil)))
+ stream))
+
+#+(and mcl (not digitool))
+(defMethod stream-writer ((stream fundamental-stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream char)
+ (write-char char stream))
+ #'(lambda (stream byte)
+ (write-byte byte stream)))
+ stream))
+
+#+CMU
+(defmethod stream-element-type ((stream stream))
+ ; (cl::fd-stream-element-type stream)
+ '(unsigned-byte 8))
+
+#+CMU
+(defMethod stream-reader ((stream stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream)
+ (read-char stream nil nil))
+ #'(lambda (stream)
+ (read-byte stream nil nil)))
+ stream))
+#+CMU
+(defMethod stream-writer ((stream stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream char)
+ (write-char char stream))
+ #'(lambda (stream byte)
+ (write-byte byte stream)))
+ stream))
+
+#+scl
+(defMethod stream-reader ((stream stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream)
+ (read-char stream nil nil))
+ #'(lambda (stream)
+ (read-byte stream nil nil)))
+ stream))
+#+scl
+(defMethod stream-writer ((stream stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream char)
+ (write-char char stream))
+ #'(lambda (stream byte)
+ (write-byte byte stream)))
+ stream))
+
+
+#+sbcl
+(defmethod stream-element-type ((stream stream))
+ ; (cl::fd-stream-element-type stream)
+ '(unsigned-byte 8))
+
+#+sbcl
+(defMethod stream-reader ((stream stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream)
+ (read-char stream nil nil))
+ #'(lambda (stream)
+ (read-byte stream nil nil)))
+ stream))
+#+sbcl
+(defMethod stream-writer ((stream stream))
+ (values (if (subtypep (stream-element-type stream) 'character)
+ #'(lambda (stream char)
+ (write-char char stream))
+ #'(lambda (stream byte)
+ (write-byte byte stream)))
+ stream))
+
+
+
+;; adapted from cl-http:mcl;server;tcp-ot-stream for the strictly binary case
+;; the first case comes into play without cl-http. connections are made with a simple tcp stream
+;; the second case takes into account, that chunking decoding extends the generic function
+#+(and mcl mactcp-compatibility)
+(defMethod stream-reader ((stream ccl::binary-tcp-stream))
+ (values #'ccl::io-buffer-read-byte (ccl::stream-io-buffer stream)))
+
+#+(and MCL CL-HTTP)
+(defmethod stream-reader ((stream ccl::modal-ascii-or-binary-tcp-stream-mixin))
+ (values (case (ccl::input-mode stream)
+ (:ascii #'stream-tyi)
+ ((:binary nil)
+ (let ((method-combination (ccl::generic-function-method-combination #'ccl::stream-read-byte))
+ (methods (compute-applicable-methods #'ccl::stream-read-byte (list stream))))
+ (ccl::compute-effective-method-function #'ccl::stream-read-byte
+ method-combination
+ methods))))
+ stream))
+
+#+(and mcl mactcp-compatibility)
+(defmethod stream-writer ((stream ccl::binary-tcp-stream))
+ (flet ((io-buffer-tyo-byte (io-buffer byte)
+ ;; ? not sure that continuability is a good idea, but
+ (unless (typep io-buffer 'ccl::io-buffer)
+ (setq io-buffer (ccl:require-type io-buffer 'ccl::io-buffer)))
+ (if (characterp byte) (setf byte (char-code byte)))
+ (ccl::%io-buffer-write-byte io-buffer byte)))
+ (values #'io-buffer-tyo-byte (ccl::stream-io-buffer stream))))
+
+
+#+(and mcl mactcp-compatibility)
+(defMethod stream-element-type ((stream ccl::binary-tcp-stream))
+ ;; mcl 4.2 yielded BASE-CHARACTER for this class and produced a character reader ...?
+ 'unsigned-byte)
+
+;; determine whether the stream supports binary operations
+
+(defGeneric is-binary-stream (stream)
+ #-allegro
+ (:method ((stream stream)) (subtypep (stream-element-type stream) 'unsigned-byte))
+ ;; allegro 6 "simple streams" can always do the byte operations
+ #+allegro
+ (:method ((stream string-stream)) nil)
+ #+allegro
+ (:method ((stream stream))
+ #+(and allegro-version>= (version>= 6 0)) t
+ #+(and allegro-version>= (not (version>= 6 0))) (subtypep (stream-element-type stream) 'unsigned-byte)
+ ))
+
+(defGeneric decoding-stream-reader (stream encoding)
+ (:method ((stream stream) (encoding null))
+ (decoding-stream-reader stream (stream-element-type stream)))
+ (:method ((stream stream) (type cons))
+ (decoding-stream-reader stream (first type)))
+ (:method ((stream stream) (encoding string) &aux canonical-encoding)
+ (cond ((setf canonical-encoding (canonical-encoding encoding))
+ (when *xml-verbose*
+ (warn "assuming ~a encoding for stream: ~s." canonical-encoding stream))
+ (decoding-stream-reader stream canonical-encoding))
+ (t
+ (warn "no decoding defined for operation on stream: ~s: ~s." stream encoding)
+ (values nil nil encoding))))
+ (:method ((stream stream) (encoding symbol) &aux canonical-encoding)
+ (cond ((setf canonical-encoding (canonical-encoding encoding))
+ (when *xml-verbose*
+ (warn "assuming ~a encoding for stream: ~s." canonical-encoding stream))
+ (decoding-stream-reader stream canonical-encoding))
+ ((subtypep encoding 'integer)
+ (decoding-stream-reader stream :autodetect))
+ ((subtypep encoding 'character)
+ (decoding-stream-reader stream *default-character-encoding*))
+ (t
+ (warn "no decoding defined for operation on stream: ~s: ~s." stream encoding)
+ (values nil nil encoding)))))
+
+(defGeneric encoding-stream-writer (stream encoding)
+ (:method ((stream t) (encoding t))
+ (warn "no decoding defined for operation on stream: ~s: ~s." encoding stream)
+ (values nil nil))
+ (:method ((stream stream) (encoding null) &aux (type (stream-element-type stream)))
+ (unless type
+ (warn "assuming element type character for stream: ~s." stream)
+ (setf type 'character))
+ (encoding-stream-writer stream type))
+ (:method ((stream stream) (type cons))
+ (encoding-stream-writer stream (first type)))
+ (:method ((stream stream) (encoding string) &aux canonical-encoding)
+ (cond ((setf canonical-encoding (canonical-encoding encoding))
+ (when *xml-verbose*
+ (warn "assuming ~a encoding for stream: ~s." canonical-encoding stream))
+ (encoding-stream-writer stream canonical-encoding))
+ (t
+ (warn "no decoding defined for operation on stream: ~s: ~s." stream encoding)
+ (values nil nil encoding))))
+ (:method ((stream stream) (encoding symbol) &aux canonical-encoding)
+ (cond ((setf canonical-encoding (canonical-encoding encoding))
+ (when *xml-verbose*
+ (warn "assuming ~a encoding for stream: ~s." canonical-encoding stream))
+ (encoding-stream-writer stream canonical-encoding))
+ ((subtypep encoding 'integer)
+ (encoding-stream-writer stream *default-binary-encoding*))
+ ((subtypep encoding 'character)
+ (encoding-stream-writer stream *default-character-encoding*))
+ (t
+ (warn "no encoding defined for operation on stream: ~s: ~s." stream encoding)
+ (values nil nil encoding)))))
+
+
+(defMacro funcall-function.arg (function.arg &rest args)
+ `(funcall (first ,function.arg) (rest ,function.arg) ,@args))
+
+(defun change-stream-decoding (new-encoding)
+ (etypecase new-encoding
+ (keyword t)
+ ((or string (and symbol (not null)))
+ (setf new-encoding (intern (string-upcase new-encoding) "KEYWORD"))))
+ (if (or (eq new-encoding *input-encoding*)
+ (and (eq new-encoding :utf-16)
+ (member *input-encoding* '(:utf-16-12 :utf-16-21))))
+ (values *input-encoding* nil)
+ (multiple-value-bind (function arg detected-encoding to-reread)
+ (decoding-stream-reader *input-source* new-encoding)
+ (unless (and (eq detected-encoding new-encoding)
+ (null to-reread))
+ (error "can't change encoding: ~s: ~s -> ~s = ~s/~s."
+ *input-source*
+ *input-encoding* new-encoding detected-encoding to-reread))
+ (unless function (error "no reader for encoding: ~s." new-encoding))
+ (setf *input-reader* function
+ *input-reader-arg* arg
+ *input-encoding* new-encoding)
+ ;; return the new encoding
+ (values new-encoding t))))
+
+;;
+;;
+;; UTF-8 is computed
+
+(defMethod decoding-stream-reader
+ ((stream stream) (encoding (eql :UTF-8)))
+ (unless (is-binary-stream stream)
+ (warn "stream type not compatible with encoding: ~s: ~s."
+ (stream-element-type stream) encoding))
+ (multiple-value-bind (function arg)
+ (stream-reader stream)
+ (let ((reader nil))
+ (setf reader #'(lambda (function.arg &aux byte1)
+ (block read-utf-8-datum
+ (flet ((read-byte-code (&aux byte)
+ (setf byte (funcall-function.arg function.arg))
+ (if (integerp byte) byte
+ (return-from read-utf-8-datum nil))))
+ (declare (type fixnum byte1)
+ (ftype (function () fixnum) read-byte-code)
+ (optimize (speed 3) (safety 0)))
+ (setf byte1 (read-byte-code))
+ (cond ((= 0 (logand #x80 byte1))
+ byte1)
+ ((= #xc0 (logand #xe0 byte1))
+ (logior (lsh (logand byte1 #x1f) 6)
+ (logand (read-byte-code) #x3f)))
+ ((= #xe0 (logand #xf0 byte1))
+ (logior (logior (lsh (logand byte1 #x0f) 12)
+ (lsh (logand (read-byte-code) #x3f) 6))
+ (logand (read-byte-code) #x3f)))
+ ((= #xf0 (logand #xf8 byte1))
+ (let ((byte2 (read-byte-code))
+ (byte3 (read-byte-code))
+ (byte4 (read-byte-code)))
+ (xml-error "unsupported unicode datum: ~s."
+ (list byte1 byte2 byte3 byte4))))
+ (t
+ (ecase *illegal-utf-data-condition*
+ ((nil) (funcall reader function.arg))
+ (error (xml-error "illegal UTF-8 data: x~2,'0x." byte1))
+ (warning (xml-warn "illegal UTF-8 data: x~2,'0x." byte1)
+ (funcall reader function.arg)))))))))
+ (values reader
+ (cons function arg)
+ :UTF-8))))
+
+
+(defMethod encoding-stream-writer
+ ((stream stream) (encoding (eql :UTF-8)))
+ (if (is-binary-stream stream)
+ (multiple-value-bind (function arg)
+ (stream-writer stream)
+ (values #'(lambda (function.arg char &aux (code (char-code char)))
+ (cond ((<= code #x007f)
+ (funcall-function.arg function.arg code))
+ ((<= code #x07ff)
+ (funcall-function.arg function.arg (logior #b11000000 (lsh code -6)))
+ (funcall-function.arg function.arg (logior #b10000000 (logand code #b00111111))))
+ ((<= code #xffff)
+ (funcall-function.arg function.arg (logior #b11100000 (lsh code -12)))
+ (funcall-function.arg function.arg (logior #b10000000 (logand (lsh code -6) #b00111111)))
+ (funcall-function.arg function.arg (logior #b10000000 (logand code #b00111111))))
+ (t
+ (xml-error "unsupported unicode datum: ~s." code))))
+ (cons function arg)))
+ (multiple-value-bind (function arg)
+ (stream-writer stream)
+ (values #'(lambda (function.arg char &aux (code (char-code char)))
+ (cond ((<= code 255)
+ (funcall-function.arg function.arg char))
+ (t
+ (let ((string (format nil "&#~d" code)))
+ (dotimes (x (length string))
+ (funcall-function.arg function.arg (char string x)))))))
+ (cons function arg)))))
+
+;;
+;;
+;; ISO-8859-1 is direct
+
+(defMethod decoding-stream-reader
+ ((stream stream) (encoding (eql :ISO-8859-1)))
+ (multiple-value-bind (function arg)
+ (stream-reader stream)
+ (if (is-binary-stream stream)
+ #-(or MCL LispWorks)
+ (multiple-value-bind (reader arg)
+ (stream-reader stream)
+ (values #'(lambda (function.arg &aux byte)
+ (setf byte (funcall-function.arg function.arg))
+ (when (integerp byte) byte))
+ (cons reader arg)
+ encoding))
+ #+(or MCL LispWorks)
+ (values function arg encoding)
+ ;; character streams must be mapped back to binary
+ (values #'(lambda (function.arg &aux char)
+ (setf char (funcall-function.arg function.arg))
+ (when (characterp char)
+ ;; hardcore tracing
+ ;; (write-char char *trace-output*)
+ (char-code char)))
+ (cons function arg)
+ encoding))))
+
+(defMethod decoding-stream-reader
+ ((stream stream) (encoding (eql :US-ASCII)))
+ (multiple-value-bind (function arg)
+ (stream-reader stream)
+ (if (is-binary-stream stream)
+ #-(or MCL LispWorks)
+ (multiple-value-bind (reader arg)
+ (stream-reader stream)
+ (values #'(lambda (function.arg &aux byte)
+ (setf byte (funcall-function.arg function.arg))
+ (when (integerp byte) byte))
+ (cons reader arg)
+ encoding))
+ #+(or MCL LispWorks)
+ (values function arg encoding)
+ ;; character streams must be mapped back to binary
+ (values #'(lambda (function.arg &aux char)
+ (setf char (funcall-function.arg function.arg))
+ (when (characterp char)
+ (char-code char)))
+ (cons function arg)
+ encoding))))
+
+#+digitool ;; fix eol
+(defMethod encoding-stream-writer
+ ((stream stream) (encoding (eql :ISO-8859-1)))
+ (multiple-value-bind (function arg)
+ (stream-writer stream)
+ (if (is-binary-stream stream)
+ (values #'(lambda (function.arg char)
+ (funcall-function.arg function.arg
+ (if (= (char-code char) #x0a)
+ #x0d
+ (char-code char))))
+ (cons function arg)
+ encoding)
+ (values #'(lambda (function.arg char)
+ (funcall-function.arg function.arg
+ (if (= (char-code char) #x0a)
+ #.(code-char #x0d)
+ char)))
+ (cons function arg)
+ encoding))))
+
+#-digitool
+(defMethod encoding-stream-writer
+ ((stream stream) (encoding (eql :ISO-8859-1)))
+ (if (is-binary-stream stream)
+ (multiple-value-bind (function arg)
+ (stream-writer stream)
+ (values #'(lambda (function.arg char)
+ (funcall-function.arg function.arg (char-code char)))
+ (cons function arg)
+ encoding))
+ (multiple-value-bind (function arg)
+ (stream-writer stream)
+ (values function arg encoding))))
+
+(defMethod encoding-stream-writer
+ ((stream stream) (encoding (eql :US-ASCII)))
+ (multiple-value-bind (function arg)
+ (stream-writer stream)
+ #+digitool
+ (if (is-binary-stream stream)
+ (values #'(lambda (function.arg char)
+ (funcall-function.arg function.arg
+ (if (= (char-code char) #x0a)
+ #x0d
+ (char-code char))))
+ (cons function arg)
+ encoding)
+ (values #'(lambda (function.arg char)
+ (funcall-function.arg function.arg
+ (if (= (char-code char) #x0a)
+ #.(code-char #x0d)
+ char)))
+ (cons function arg)
+ encoding))
+ #-digitool
+ (if (is-binary-stream stream)
+ (values #'(lambda (function.arg char)
+ (funcall-function.arg function.arg (char-code char)))
+ (cons function arg)
+ encoding)
+ (values function arg encoding))))
+
+;;
+;;
+;; UTF-16 distinguishes encoding order:
+;; UTF-16LE is UTF16 in "little-endian" byte order. (order mark is 0xFF 0xFE)
+;; UTF-16BE is UTF16 in "big-endian" byte order. (order mark is 0xFE 0xFF)
+
+(defMethod decoding-stream-reader
+ ((stream stream) (encoding (eql :UTF-16)))
+ (decoding-stream-reader stream *default-utf-16-encoding*))
+
+(defMethod encoding-stream-writer
+ ((stream stream) (encoding (eql :UTF-16)))
+ (encoding-stream-writer stream *default-utf-16-encoding*))
+
+
+(defMethod decoding-stream-reader
+ ((stream stream) (encoding (eql :UTF-16-12)))
+ (unless (is-binary-stream stream)
+ (warn "stream type not compatible with encoding: ~s: ~s."
+ (stream-element-type stream) encoding))
+ (multiple-value-bind (function arg)
+ (stream-reader stream)
+ (values #'(lambda (function.arg)
+ (declare (optimize (speed 3) (safety 0)))
+ (block read-utf-16-datum
+ (flet ((read-byte-code (&aux byte)
+ (setf byte (funcall-function.arg function.arg))
+ (if (integerp byte) byte
+ (return-from read-utf-16-datum nil))))
+ (declare (ftype (function () fixnum) read-byte-code))
+ (+ (lsh (read-byte-code) 8) (read-byte-code)))))
+ (cons function arg)
+ encoding)))
+
+(defMethod encoding-stream-writer
+ ((stream stream) (encoding (eql :UTF-16-12)))
+ (unless (is-binary-stream stream)
+ (warn "stream type not compatible with encoding: ~s: ~s."
+ (stream-element-type stream) encoding))
+ (multiple-value-bind (function arg)
+ (stream-writer stream)
+ (values #'(lambda (function.arg datum)
+ (setf datum (char-code datum))
+ (funcall-function.arg function.arg (logand #xff (lsh datum -8)))
+ (funcall-function.arg function.arg (logand #xff datum)))
+ (cons function arg))))
+
+
+(defMethod decoding-stream-reader
+ ((stream stream) (encoding (eql :UTF-16-21)))
+ (unless (is-binary-stream stream)
+ (warn "stream type not compatible with encoding: ~s: ~s."
+ (stream-element-type stream) encoding))
+ (multiple-value-bind (function arg)
+ (stream-reader stream)
+ (values #'(lambda (function.arg)
+ (declare (optimize (speed 3) (safety 0)))
+ (block read-utf-16-datum
+ (flet ((read-byte-code (&aux byte)
+ (setf byte (funcall-function.arg function.arg))
+ (if (integerp byte) byte
+ (return-from read-utf-16-datum nil))))
+ (declare (ftype (function () fixnum) read-byte-code))
+ (+ (read-byte-code) (lsh (read-byte-code) 8)))))
+ (cons function arg)
+ encoding)))
+
+(defMethod encoding-stream-writer
+ ((stream stream) (encoding (eql :UTF-16-21)))
+ (unless (is-binary-stream stream)
+ (warn "stream type not compatible with encoding: ~s: ~s."
+ (stream-element-type stream) encoding))
+ (multiple-value-bind (function arg)
+ (stream-writer stream)
+ (values #'(lambda (function.arg datum)
+ (setf datum (char-code datum))
+ (funcall-function.arg function.arg (logand #xff datum))
+ (funcall-function.arg function.arg (logand #xff (lsh datum -8))))
+ (cons function arg))))
+
+
+
+;;
+;;
+;; detect encoding by reading the initial content. works for binary streams only
+
+(defMethod decoding-stream-reader
+ ((stream stream) (encoding (eql :autodetect)) &aux byte0 byte1 to-reread)
+ "see PR-xml Appendix F"
+ (multiple-value-bind (reader arg) (stream-reader stream)
+ (flet ((next-byte (&aux (byte (funcall reader arg)))
+ (typecase byte
+ (fixnum byte)
+ (t nil))))
+ (case (setf byte0 (next-byte))
+ (#x00 (case (next-byte)
+ (#x00 (case (next-byte)
+ (#x3c (if (= (next-byte) #x00)
+ (setf encoding :UCS-4-2143 to-reread "<")
+ (error "markup stream corrupt: ~s." stream)))
+ (#x00 (if (= (next-byte) #x3c)
+ (setf encoding :UCS-4-1234 to-reread "<")
+ (error "markup stream corrupt: ~s." stream)))
+ (#xFE (if (= (next-byte) #xFF)
+ (setf encoding :UCS-4-1234 to-reread nil)
+ (error "markup stream corrupt: ~s." stream)))
+ (#xFF (if (= (next-byte) #xFE)
+ (setf encoding :UCS-4-2143 to-reread nil)
+ (error "markup stream corrupt: ~s." stream)))
+ (t (error "markup stream corrupt: ~s." stream))))
+ (#x3c (if (= (setf byte1 (next-byte)) #x00)
+ (case (setf byte1 (next-byte))
+ (#x00 (setf encoding :UCS-4-3412 to-reread "<"))
+ (#x3f
+ (when *xml-verbose*
+ (warn "assuming UTF-16-12 encoding for stream: ~s." stream))
+ (setf encoding :UTF-16-12 to-reread "<?"))
+ (t (|EC: Byte Order Mark| :data (list #x00 #x3c #x00 byte1))))
+ (|EC: Byte Order Mark| :data (list #x00 #x3c byte1))))
+ (t
+ (error "markup stream corrupt: ~s." stream))))
+ (#x3c (case (setf byte1 (next-byte))
+ (#x00 (case (setf byte1 (next-byte))
+ (#x3f (case (setf byte1 (next-byte))
+ (#x00
+ (when *xml-verbose*
+ (warn "assuming UTF-16-21 encoding for stream: ~s." stream))
+ (setf encoding :UTF-16-21 to-reread "<?"))
+ (t
+ (|EC: Byte Order Mark| :data (list #x3c #x00 #x3f byte1)))))
+ (#x00 (if (= (next-byte) #x00)
+ (setf encoding :UCS-4-4321 to-reread "<")
+ (|EC: Byte Order Mark| :data (list #x3c #x00 #x00 byte1))))
+ (t
+ (|EC: Byte Order Mark| :data (list #x3c #x00 byte1)))))
+ (#x3f (setf encoding *default-binary-encoding* to-reread "<?"))
+ (t
+ (unless (or (xml-initial-namechar? byte1) (= byte1 #.(char-code #\!)))
+ (when *xml-verbose*
+ (warn "assuming UTF-8 encoding for stream: ~s." stream)))
+ (setf encoding *default-binary-encoding* to-reread (list byte0 byte1)))))
+ (#xEF (case (setf byte1 (next-byte))
+ (#xBB (if (= (setf byte1 (next-byte)) #xBF)
+ (setf encoding :UTF-8 to-reread nil)
+ (|EC: Byte Order Mark| :data (list #xEF #xBB byte1))))
+ (t
+ (|EC: Byte Order Mark| :data (list #xEF byte1)))))
+ (#xff
+ (if (= (setf byte1 (next-byte)) #xfe)
+ (let ((byte2 (next-byte)) (byte3 (next-byte)))
+ (if (and (= byte2 0) (= byte3 0))
+ (setf encoding :UCS4-4321 to-reread nil)
+ (setf encoding :UTF-16-21 to-reread (list (+ byte2 (lsh byte3 8))))))
+ (|EC: Byte Order Mark| :data (list #xff byte1))))
+ (#xfe
+ (if (= (setf byte1 (next-byte)) #xff)
+ (let ((byte2 (next-byte)) (byte3 (next-byte)))
+ (if (and (= byte2 0) (= byte3 0))
+ (setf encoding :UCS4-3412 to-reread nil)
+ (setf encoding :UTF-16-12 to-reread (list (+ (lsh byte2 8) byte3)))))
+ (|EC: Byte Order Mark| :data (list #xfe byte1))))
+ ((nil) ;; no data in stream
+ (setf encoding :UTF-8 to-reread nil))
+ (t
+ (when *xml-verbose*
+ (warn "assuming UTF-8 encoding for stream: ~s." stream))
+ (setf encoding :UTF-8 to-reread (list byte0))))
+ (multiple-value-bind (reader arg encoding) (decoding-stream-reader stream encoding)
+ (values reader arg encoding to-reread)))))
+
+
+
+#|
+
+(defun utf-8-decoding (byte1 &optional (byte2 0) (byte3 0) (byte4 0) &rest ignore)
+ (declare (ignore ignore))
+ (cond ((= 0 (logand #x80 byte1))
+ (values byte1 1))
+ ((= #xc0 (logand #xe0 byte1))
+ (values (logior (lsh (logand byte1 #x1f) 6) (logand byte2 #x3f))
+ 2))
+ ((= #xe0 (logand #xf0 byte1))
+ (values (logior (logior (lsh (logand byte1 #x0f) 12) (lsh (logand byte2 #x3f) 6)) (logand byte3 #x3f))
+ 3))
+ ((= #xf0 (logand #xf8 byte1))
+ (values (logior (logior (lsh (logand byte1 #x03) 18)
+ (lsh (logand byte2 #x3f) 12))
+ (logior (lsh (logand byte3 #x3f) 6)
+ (logand byte4 #x3f)))
+ 4))
+ (t
+ (xml-error "illegal UTF-8 data: #x~2,'0x." byte1))))
+
+(xml-namechar? (utf-8-decoding 194 183 0 0))
+(xml-space? (utf-8-decoding 239 187 191))
+
+(apply #'utf-8-decoding (map 'list #'char-code "༤"))
+
+(defun utf-8-decodingXstring (string)
+ (handler-case
+ (apply #'utf-8-decoding (map 'list #'char-code string))
+ (error (condition) (format nil "~s(~{~2,'0x~}) -> ~a"
+ string (map 'list #'char-code string)
+ condition))))
+
+(format nil "~{~8,'0x~^~%~}" (mapcar #'(lambda (string) (multiple-value-list
+ (utf-8-decodingXstring string)))
+ '("" "氏" "" "�" "�")))
+
+(defGeneric decode-utf8 (source)
+ (:method ((string string)) (decode-utf8 (map 'list #'char-code string)))
+ (:method ((vector vector)) (decode-utf8 (map 'list #'identity vector)))
+ (:method ((source list))
+ (let ((result nil))
+ (loop (unless source (return (reverse result)))
+ (multiple-value-bind (decoded code-unit-count)
+ (apply #'utf-8-decoding source)
+ (push (cons (if (< decoded char-code-limit)
+ (cons (code-char decoded) (format nil "#u~4,'0x" decoded))
+ (format nil "#u~4,'0x" decoded))
+ code-unit-count)
+ result)
+ (setf source (nthcdr code-unit-count source)))))))
+
+(decode-utf8 "asdfqwer")
+(decode-utf8 "")
+(decode-utf8 #(#x3c #x42 #x69 #x72 #x74 #x68 #x43 #x69 #x74 #x79 #x3e #x4b #xef #xbf #xbd #x2f
+ #x42 #x69 #x72 #x74 #x68 #x43 #x69 #x74 #x79 #x3e))
+
+from the 3.1 unicode report
+
+ Table 3.1.
+ UTF-8 Bit Distribution
+ Scalar Value UTF-16 1st Byte 2nd Byte 3rd Byte 4th Byte
+ 00000000 0xxxxxxx 00000000 0xxxxxxx 0xxxxxxx
+
+ 00000yyy yyxxxxxx 00000yyy yyxxxxxx 110yyyyy 10xxxxxx
+
+ zzzzyyyy yyxxxxxx zzzzyyyy yyxxxxxx 1110zzzz 10yyyyyy 10xxxxxx
+
+ 000uuuuu zzzzyyyy 110110ww wwzzzzyy 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx
+ yyxxxxxx 110111yy yyxxxxxx
+
+Where uuuuu = wwww + 1 (to account for addition of 1000016 as in Section 3.7, Surrogates).
+
+|#
+:EOF
1
0
Author: janderson
Date: Mon May 28 07:40:42 2007
New Revision: 16
Added:
trunk/tests/xml/LIBRARY1.xml
- copied unchanged from r15, trunk/tests/xml/LIBRARY2.xml
Removed:
trunk/tests/xml/LIBRARY2.xml
Log:
renamed to eliminate ambiguity
1
0
Author: janderson
Date: Mon May 28 07:39:48 2007
New Revision: 15
Removed:
trunk/tests/xml/LIBRARY1.XML
Log:
delete ambiguous file
1
0
Author: janderson
Date: Mon May 28 07:36:52 2007
New Revision: 14
Added:
trunk/tests/xml/LIBRARY2.xml
- copied unchanged from r13, trunk/tests/xml/LIBRARY1.xml
Removed:
trunk/tests/xml/LIBRARY1.xml
Log:
rename for ambiguous name
1
0
Author: banderson
Date: Tue Feb 14 12:03:43 2006
New Revision: 13
Modified:
branches/sbcl-0.9.x-testing/ (props changed)
Log:
some svn:ignore stuffs
1
0
[cl-xml-cvs] r12 - in branches/sbcl-0.9.x-testing: . code/base library library/de/setf/utility
by banderson@common-lisp.net 14 Feb '06
by banderson@common-lisp.net 14 Feb '06
14 Feb '06
Author: banderson
Date: Tue Feb 14 11:57:14 2006
New Revision: 12
Added:
branches/sbcl-0.9.x-testing/cl-xml.asd
Modified:
branches/sbcl-0.9.x-testing/code/base/parameters.lisp
branches/sbcl-0.9.x-testing/library/de/setf/utility/conditions.lisp
branches/sbcl-0.9.x-testing/library/define-system.lisp
branches/sbcl-0.9.x-testing/load.lisp
branches/sbcl-0.9.x-testing/sysdcl.lisp
Log:
rest of changes/hacks for CL-XML to work with SBCL 0.9.8
Added: branches/sbcl-0.9.x-testing/cl-xml.asd
==============================================================================
--- (empty file)
+++ branches/sbcl-0.9.x-testing/cl-xml.asd Tue Feb 14 11:57:14 2006
@@ -0,0 +1,48 @@
+;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
+
+(defpackage #:cl-xml-system
+ (:use #:cl #:asdf))
+
+(in-package #:cl-xml-system)
+
+;; set some options
+(pushnew :xml-symbols *features*)
+(setf *features* (remove :nameset-tokenizer *features*))
+
+;; system
+(defsystem cl-xml
+ :description "Common Lisp support for the 'Extensible Markup Language'"
+ :author "James Anderson <janderson(a)ravenpack.com>"
+ :version "0.949"
+ :licence "LGPL"
+ :components
+ ((:module
+ :library
+ :components
+ ((:file "define-system")))
+ (:file "sysdcl" :depends-on (:library))
+ (:file "load" :depends-on ("sysdcl"))))
+;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
+
+(defpackage #:cl-xml-system
+ (:use #:cl #:asdf))
+
+(in-package #:cl-xml-system)
+
+;; set some options
+(pushnew :xml-symbols *features*)
+(setf *features* (remove :nameset-tokenizer *features*))
+
+;; system
+(defsystem cl-xml
+ :description "Common Lisp support for the 'Extensible Markup Language'"
+ :author "James Anderson <janderson(a)ravenpack.com>"
+ :version "0.949"
+ :licence "LGPL"
+ :components
+ ((:module
+ :library
+ :components
+ ((:file "define-system")))
+ (:file "sysdcl" :depends-on (:library))
+ (:file "load" :depends-on ("sysdcl"))))
Modified: branches/sbcl-0.9.x-testing/code/base/parameters.lisp
==============================================================================
--- branches/sbcl-0.9.x-testing/code/base/parameters.lisp (original)
+++ branches/sbcl-0.9.x-testing/code/base/parameters.lisp Tue Feb 14 11:57:14 2006
@@ -77,7 +77,7 @@
(defVar *xml-base* nil
"binds the base uri to serve as the context when resoving identifiers to URLs.
- parsers bind it to each entity's url to enable rrealtive url references.")
+ parsers bind it to each entity's url to enable relative url references.")
(defVar *xml-verbose* nil
"controls diagnostic messages.")
Modified: branches/sbcl-0.9.x-testing/library/de/setf/utility/conditions.lisp
==============================================================================
--- branches/sbcl-0.9.x-testing/library/de/setf/utility/conditions.lisp (original)
+++ branches/sbcl-0.9.x-testing/library/de/setf/utility/conditions.lisp Tue Feb 14 11:57:14 2006
@@ -23,6 +23,9 @@
;; patch restrictive condition implementations
+#+(and sbcl sb-package-locks)
+(sb-ext:unlock-package :cl)
+
(let ((def (fdefinition 'SIMPLE-CONDITION-FORMAT-ARGUMENTS)))
(unless (typep def 'generic-function)
(warn "redefining SIMPLE-CONDITION-FORMAT-ARGUMENTS")
@@ -46,6 +49,8 @@
(defGeneric SIMPLE-CONDITION-FORMAT-string (condition)
(:method ((condition t)) (funcall def condition))))))
+#+(and sbcl sb-package-locks)
+(sb-ext:lock-package :cl)
;;
Modified: branches/sbcl-0.9.x-testing/library/define-system.lisp
==============================================================================
--- branches/sbcl-0.9.x-testing/library/define-system.lisp (original)
+++ branches/sbcl-0.9.x-testing/library/define-system.lisp Tue Feb 14 11:57:14 2006
@@ -18,8 +18,6 @@
(defParameter *physical-binary-type*
(pathname-type (compile-file-pathname (make-pathname :name "source" :type *physical-source-type*))))
-#+sbcl
-(setq sb-fasl:*fasl-file-type* "sbcfsl")
(defMacro define-system ((name &key description) (&rest operations) &body files)
(if operations
@@ -98,10 +96,10 @@
(call-with-src-and-bin
#'(lambda (filename src bin probed-src probed-bin)
(if probed-src
- (defsys-message *trace-output*
- "~%; ~s~@[ (@ ~/print-universal-time/)~] -> ~s (~:[missing~;~1:*@ ~/print-universal-time/~])..."
- probed-src (file-write-date probed-src) bin (when probed-bin (file-write-date probed-bin)))
- (warn "file missing: ~s (= ~s)." filename src)))
+ (defsys-message *trace-output*
+ "~%; ~s~@[ (@ ~/print-universal-time/)~] -> ~s (~:[missing~;~1:*@ ~/print-universal-time/~])..."
+ probed-src (file-write-date probed-src) bin (when probed-bin (file-write-date probed-bin)))
+ (warn "file missing: ~s (= ~s)." filename src)))
filename))
(defun system-p (datum)
Modified: branches/sbcl-0.9.x-testing/load.lisp
==============================================================================
--- branches/sbcl-0.9.x-testing/load.lisp (original)
+++ branches/sbcl-0.9.x-testing/load.lisp Tue Feb 14 11:57:14 2006
@@ -2,23 +2,24 @@
(in-package :CL-USER)
-;;; load configuration without CL-HTTP and with name symbols:
+;; FIXME: sbcl/clc only right now BSA
+(let ((path "/usr/share/common-lisp/source/cl-xml/"))
-#+CL-HTTP
-(cerror "continue load."
- "this is intended to load a configuration without CL-HTTP, yet CL-HTTP is present.")
-
-(load (merge-pathnames (make-pathname :name "define-system" :directory '(:relative "library"))
- *load-pathname*))
-
-(register-system-definition :xparser (merge-pathnames (make-pathname :name "sysdcl") *load-pathname*))
-
-(pushnew :xml-symbols *features*)
-(setf *features* (remove :nameset-tokenizer *features*))
-(execute-system-operations :xparser '(:compile :load))
-
-(format *trace-output* "~%cl xml loaded:~%~s" *features*)
-
-;(execute-system-operations :xtests '( :load))
-
-:EOF
+;; (or (when *load-truename*
+;; (directory-namestring *load-truename*) )
+;; *default-pathname-defaults*)))
+
+;; (format t "~%~%path: ~a~%~%" path)
+ (format t "~%~%path: ~a~%~%" (merge-pathnames (make-pathname :name "sysdcl") path))
+
+ (register-system-definition :xparser
+ (merge-pathnames
+ (make-pathname :name "sysdcl")
+ path))
+ (execute-system-operations :xparser '(:compile :load))
+
+ (register-system-definition :xpath
+ (merge-pathnames
+ (make-pathname :name "sysdcl")
+ path))
+ (execute-system-operations :xpath '(:compile :load)))
Modified: branches/sbcl-0.9.x-testing/sysdcl.lisp
==============================================================================
--- branches/sbcl-0.9.x-testing/sysdcl.lisp (original)
+++ branches/sbcl-0.9.x-testing/sysdcl.lisp Tue Feb 14 11:57:14 2006
@@ -1 +1,414 @@
-;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: cl-user; -*-
#|
<DOCUMENTATION>
<DESCRIPTION>
implementation packages for
<ul>
<li> XQDM: an xml document model which follows the xml-query document
model.</li>
<li> XQ: a serializer (parser/reader and writer functions) for the document
aspects of xml-query algebra expressions based on the XQDM.</li>
<li> XPATH: a parser/reader and interpreter for xpath expressions.</li>
<li> XMLP: a parser for xml expressions based onthe XQDM.</li>
<!-- <li> XMLP: a compatibility package downwards compatible to the older XMLP
package.</li> was considered, but not implemented -->
</ul>
</DESCRIPTION>
<COPYRIGHT YEAR='2001' AUTHOR='james adam anderson' MARK='(C)'
mailto='james.anderson(a)setf.de' />
<LICENSE href='file://xml/LGPL.txt' >
This library is free software;
With the exceptions noted below, you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version,
as ammended below.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The terms of the GNU Lesser General Public License are ammended to include
the stipulation, as paragraph 2.e, that any modifications to the library for
the purpose of correcting bugs must be returned to the copyright holder
for inclusion in future versions of the library.
</LICENSE>
<LICENSE href='file://xml/base/tokenizer.lisp'>
the license terms for tokenizer implementation are described in the
respective source file.
</LICENSE>
<LICENSE href='file://xml/bnf/xml-grammar.bnf'>
the www-consortium retains license rights to the respective bnf.
it is distributed herewith under the terms of their software license.</LICENSE>
<LICENSE href='file://xml/bnf/xpath-grammar.bnf'>
the www-consortium retains license rights to the respective bnf.
it is distributed herewith under the terms of their software license.</LICENSE>
<LICENSE href='file://xml/bnf/xql-grammar.bnf'>
the www-consortium retains license rights to the respective bnf.
it is distributed herewith under the terms of their software license.</LICENSE>
<LICENSE href='file://xml/demos/saxandsoap/*.lisp'>
<COPYRIGHT YEAR='2001' AUTHOR='Stanley Knutson' MARK='(C)'
mailto='knewt(a)alum.mit.edu' />
for information on this module, please contact the author.</LICENSE>
<CHRONOLOGY>
<!-- nb. this version number tracks that of the 'parser' module.
the others vary independently. -->
<DELTA DATE='20010605' AUTHOR='MS' VERSION='0.907'>
lispworks/ansi conformance</DELTA>
<DELTA DATE='20010608' VERSION='0.908'>
CL-HTTP in ALLEGRO</DELTA>
<DELTA DATE='20010621'>xml-writer</DELTA>
<DELTA DATE='20010702'>vector-stream moved to utils for data-url support</DELTA>
<DELTA DATE='20010910' VERSION='0.912'>xparser tokenizers</DELTA>
<DELTA DATE='20010910' VERSION='0.914'>0.912+lw/allegro tests</DELTA>
<DELTA DATE='20010918' VERSION='0.915'>first-level tokenization</DELTA>
<DELTA DATE='20011203' VERSION='0.916'>fixes for instance name compilation;<br />
lispworks comm package(including conditionalization 20020115)</DELTA>
<DELTA DATE='20020117'>lispworks charachter element set for two-byte characters</DELTA>
<DELTA DATE='20030408' VERSION='0.949'>
</CHRONOLOGY>
</DOCUMENTATION>
|#
(in-package "CL-USER")
(eval-when (:load-toplevel :compile-toplevel :execute)
(let* ((defaults
#+allegro (or *load-truename* *load-pathname* *compile-file-truename*)
#+ccl *load-truename*
#+cmu *load-truename*
#+cormanlisp #p"d:\\Source\\Lisp\\XML-0-918\\sysdcl.lisp"
#+lispWorks (truename (lw:current-pathname))
#+sbcl (or *load-truename* *load-pathname*)
)
(bin-target nil)
(root-target (make-pathname :name :wild :type :wild :version :newest
:directory (append (pathname-directory defaults)
'(:wild-inferiors))
:defaults defaults)))
;; w/o bootstrap lispworks collapsed the bin target to host and type
(setf (logical-pathname-translations "xml")
`(("root;**;*.*.*" ,root-target)))
(setf bin-target
(make-pathname :name :wild
:type (pathname-type (compile-file-pathname "xml:name.lisp"))
:version :newest
:defaults
#+digitool "xml:root;bin;digifasl;**;*.*.*"
#+(and mcl m68k) "xml:root;bin;digim68kfasl;**;*.*.*"
#+(and allegro allegro-version>= (not (version>= 6 0))) "xml:root;bin;acl5fasl;**;*.*.*"
#+(and allegro allegro-version>= (version>= 6 0)) "xml:root;bin;acl6fasl;**;*.*.*"
#+(and lispworks (not mac)) "xml:root;bin;lwfasl;**;*.*.*"
#+(and lispworks mac) "xml:root;bin;lwppcfasl;**;*.*.*"
#+cormanlisp "xml:root;bin;corfasl;**;*.*.*"
#+openmcl "xml:root;bin;omclfasl;**;*.*.*"
#+cmu "xml:root;bin;cmuclfasl;**;*.*.*"
#+sbcl "xml:root;bin;sbclfasl;**;*.*.*"
))
(when *load-verbose*
(format *trace-output* "~%load defaults: ~s.~%compile target: ~s."
defaults bin-target))
(setf (logical-pathname-translations "xml")
`(("**;*.bin.*" ,bin-target)
("**;*.BIN.*" ,bin-target)
("code;**;*.*.*" "xml:root;code;**;*.*.*")
("root;**;*.*.*" ,root-target)
("**;*.bnf.*" "xml:root;bnf;*.*.*")
("**;*.BNF.*" "xml:root;bnf;*.*.*")
("**;*.*.*" "xml:root;**;*.*.*")))
(unless (ignore-errors (LOGICAL-PATHNAME-TRANSLATIONS "Packages"))
(setf (logical-pathname-translations "Packages")
`(("**;*.bin.*" ,bin-target)
("**;*.BIN.*" ,bin-target)
("**;*.*.*" "xml:Library;**;*.*")
("*.*.*" "xml:Library;**;*.*"))))
))
;; configuration
;;
#+CL-HTTP ;; nb. this check is effective in the fasl only
(unless (find :cl-http *features*)
(warn "CL-HTTP not present."))
;;
;; network access
#+(and MCL (not CL-HTTP) (not openmcl))
(eval-when (:compile-toplevel :load-toplevel :execute)
(define-declaration values nil)
(define-declaration arglist nil)
(require "OPENTRANSPORT"))
#+openmcl
(progn
(define-declaration values nil)
(define-declaration arglist nil))
#+(and ALLEGRO (not CL-HTTP))
(eval-when (:compile-toplevel :load-toplevel :execute)
(require "SOCK"))
#+LispWorks
(eval-when (:compile-toplevel :load-toplevel :execute)
(require "comm"))
;; to indicate whether or not to model names as symbols or as instances
;; (pushnew :xml-symbols *features*)
;; to specify the instance names should use tokenizers
(pushnew :nameset-tokenizer *features*)
;; to indicate that all name and string characters are to be checked for legality
;; (pushnew :xml-check-char-codes *features*)
#+Allegro
(when (< excl:real-char-code-limit 65535)
(pushnew :xml-check-char-codes *features*))
#-Allegro
(when (< char-code-limit 65535)
(pushnew :xml-check-char-codes *features*))
#|
;; 20020410.jaa setting the value globally turns out to be inappropriate.
;; the alternative, dynamical binding, is said to be insufficient to affect internal
;; state.
#+LispWorks
(lw:set-default-character-element-type 'lw:simple-char)
;; should that change, the alternative would have been
#+LispWorks ; cause lispworks to use wide-character strings
(lw:*default-character-element-type* 'lw:simple-char)
|#
#+cmu
(progn
(require :gray-streams)
(setq extensions:*inline-expansion-limit* 2)
)
#+sbcl
(progn
(require :gray-streams)
(setq *inline-expansion-limit* 2)
)
#+ccl-5-0-and-0-918
(setq CCL::*CHECK-SLOT-TYPE* nil)
;; the atn-bnf parser must be loaded in order to translate grammars,
;; for regular expressions, and for validation. this is reflected in it presence
;; in the :xparser definition below.
;; nb. this should be refined to load only the minimum for runtime use
(eval-when (:compile-toplevel :execute :load-toplevel)
(define-system
(:base)
()
"xml:code;patch;cmucl"
"xml:library;de;setf;utility;package"
"xml:library;de;setf;utility;string"
"xml:library;de;setf;utility;conditions"
"xml:library;de;setf;utility;test"
"xml:code;base;package"
)
(define-system
(:bnfp)
()
:base
; merged into common package file "xml:code;packages;atn-package"
"xml:code;atn-parser;clifs;inference-system-classes"
"xml:code;atn-parser;clifs;inference-units"
"xml:code;atn-parser;atn-parameters"
"xml:code;atn-parser;atn-classes"
"xml:code;atn-parser;atn-macros"
"xml:code;atn-parser;ebnf-tokenizer"
"xml:code;atn-parser;ebnf-to-atn-translator"
"xml:code;atn-parser;atn-macro-to-canonic-form"
"xml:code;atn-parser;ebnf-grammar.atn" ;; the bnf grammar is coded in a "atn" syntax lisp file.
"xml:code;atn-parser;atn-runtime"
"xml:code;atn-parser;conditions"
"xml:code;atn-parser;atn-lisp-compiler"
"xml:code;atn-parser;atn-regex"
;; the java translator is present here as documentation, as of 20010208 it has
;; not been reintegrated with the changes to compile to lisp.
#+bnfp-java "xml:code;atn-parser;atn-java-compiler"
)
(define-system
(:xutil :description "xml base utilities")
()
:bnfp
"xml:code;base;parameters"
"xml:code;base;cllib"
#+CL-HTTP "xml:code;base;cl-http-utils"
"xml:code;base;utils"
"xml:code;base;parsetable"
"xml:code;base;vector-stream"
#-CL-HTTP "xml:code;base;www-utils-ersatz"
#-CL-HTTP "xml:code;base;tokenizer"
"xml:code;base;conditions")
(define-system
(xqdm :description "model from the x-query data model")
()
:xutil
;; for 0.918 namespaces operations must be defined first
"xml:code;xquerydatamodel;xqdm-namespaces"
"xml:code;xquerydatamodel;xqdm-parameters"
"xml:code;xquerydatamodel;xqdm-character-classes"
"xml:code;xquerydatamodel;xqdm-classes"
"xml:code;xquerydatamodel;xsd-types"
"xml:code;xquerydatamodel;conditions;names;conditions"
"xml:code;xquerydatamodel;conditions;node;conditions"
"xml:code;xquerydatamodel;conditions;model;conditions"
"xml:code;xquerydatamodel;xqdm-operators"
;; "xml:code;xquerydatamodel;xqdm-qnames"
"xml:code;xquerydatamodel;xqdm-validation"
"xml:code;xquerydatamodel;qname-resolution"
"xml:code;xquerydatamodel;xqdm-graph"
"xml:code;xquerydatamodel;node-path-walk"
"xml:code;xquerydatamodel;xqdm-walk"
"xml:code;xquerydatamodel;xqdm-walk-accessors")
(define-system
(xparser :description "xml processor: parsing/serialization for xqdm with standard encoding")
()
:xutil :xqdm
"xml:code;xparser;xml-parameters"
"xml:code;xparser;conditions;codec;conditions"
"xml:code;xparser;xml-stream-coding"
"xml:code;xparser;xml-operators"
"xml:code;xparser;xml-readers"
"xml:code;xparser;xml-tokenizer"
"xml:code;xparser;xml-processing-instruction"
"xml:code;xparser;xml-constructors"
"xml:code;xparser;xml-parser"
"xml:code;xparser;xml-printer"
"xml:code;xparser;xml-writer")
(define-system
(:xpath :description "xml path model and encoding to extend the processor")
()
:xparser
"xml:code;xpath;xpath-parameters"
"xml:code;xpath;xpath-tokenizer"
"xml:code;xpath;xpath-classes"
"xml:code;xpath;xpath-operators"
"xml:code;xpath;xpath-constructors"
"xml:code;xpath;xpath-parser"
"xml:code;xpath;xpath-printer"
"xml:code;xpath;xpath-library")
(define-system
(:xquery :description "xml query processor based on xml processor and xml path")
()
:xparser :xpath
"xml:code;xquery;xq-parameters"
"xml:code;xquery;xqa-classes"
"xml:code;xquery;xqa-operators"
"xml:code;xquery;xql-operators"
"xml:code;xquery;xqa-library"
"xml:code;xquery;xql-library"
"xml:code;xquery;xql-tokenizer"
"xml:code;xquery;xql-constructors"
"xml:code;xquery;xql-parser"
"xml:code;xquery;xq-printer"
)
(define-system
(:xtests
:description
"loads test files")
()
:xparser
"xml:tests;xquerydatamodel;model"
"xml:tests;parser;bom"
"xml:tests;parser;document-internal"
"xml:tests;parser;document-external"
"xml:tests;parser;document-specialized"
"xml:tests;parser;qnames.lisp"
"xml:tests;parser;validation.lisp"
"xml:tests;parser;namespaces.lisp"
"xml:tests;parser;oasis.lisp"
)
(define-system
(:xrelease
:description
"loads test files")
()
:xtests
"xml:code;base;release"
"xml:*.lisp"
"xml:demos;**;*.*"
"xml:library;define-system.lisp"
"xml:**;*.bnf"
"xml:**;*.htm"
"xml:**;*.gif"
"xml:**;*.xql"
"xml:**;*.xml*"
"xml:**;*.dtd"
"xml:**;*.xmlq"
"xml:**;*.txt"
)
(define-system
(:xconformance
:description
"incorporates conformance data files")
()
"xml:standards;XML;XMLConf;**;*.xml"
"xml:standards;XML;XMLConf;**;*.mod"
"xml:standards;XML;XMLConf;**;*.dtd"
"xml:standards;XML;XMLConf;**;*.ent"
"xml:standards;XML;REC-xml-20001006.xml"
"xml:standards;XML;xmlspec-v21.dtd"
"xml:standards;XML;W3CSchema;*.xsd"
"xml:standards;XML;W3CSchema;*.dtd"
"xml:standards;XML;XHTML-MODULAR;**;*.*"
)
)
;; see also xml:tests;test.lisp
;; (load "entwicklung@paz:sourceServer:lisp:xml:define-system.lisp")
;; (register-system-definition :xparser "entwicklung@paz:sourceServer:lisp:xml:sysdcl.lisp")
;; (execute-system-operations :xutil '(:load))
;; (execute-system-operations :xparser '(:load))
;; to test if the pathnames are ok.
;; (execute-system-operations :xparser '(:probe))
;; to load
;; (execute-system-operations :xparser '(:load))
;; (execute-system-operations :xquery '(:load))
;; to compile / load
;; (execute-system-operations :xparser '(:compile))
;; (execute-system-operations :xparser '(:compile :load))
;; (execute-system-operations :xquery '(:compile :load))
;; (execute-system-operations :xquery #'print)
;; (translate-logical-pathname "xml:xxx;yyy;xml-grammar.bnf")
;; (translate-logical-pathname "xml:bnfp;sysdcl")
;; (translate-logical-pathname "xml:code;xquery;xq-printer.lisp")
;; (translate-logical-pathname "xml:code;xquery;xq-printer.bin")
;; (translate-logical-pathname "xml:demo;xq-printer.lisp")
;; (translate-logical-pathname "xml:demo;xq-printer.bin")
:EOF
\ No newline at end of file
+;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: cl-user; -*-
+
+#|
+<DOCUMENTATION>
+ <DESCRIPTION>
+ implementation packages for
+ <ul>
+ <li> XQDM: an xml document model which follows the xml-query document
+ model.</li>
+ <li> XQ: a serializer (parser/reader and writer functions) for the document
+ aspects of xml-query algebra expressions based on the XQDM.</li>
+ <li> XPATH: a parser/reader and interpreter for xpath expressions.</li>
+ <li> XMLP: a parser for xml expressions based onthe XQDM.</li>
+ <!-- <li> XMLP: a compatibility package downwards compatible to the older XMLP
+ package.</li> was considered, but not implemented -->
+ </ul>
+ </DESCRIPTION>
+ <COPYRIGHT YEAR='2001' AUTHOR='james adam anderson' MARK='(C)'
+ mailto='james.anderson(a)setf.de' />
+ <LICENSE href='file://xml/LGPL.txt' >
+ This library is free software;
+ With the exceptions noted below, you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version,
+ as ammended below.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ The terms of the GNU Lesser General Public License are ammended to include
+ the stipulation, as paragraph 2.e, that any modifications to the library for
+ the purpose of correcting bugs must be returned to the copyright holder
+ for inclusion in future versions of the library.
+ </LICENSE>
+ <LICENSE href='file://xml/base/tokenizer.lisp'>
+ the license terms for tokenizer implementation are described in the
+ respective source file.
+ </LICENSE>
+ <LICENSE href='file://xml/bnf/xml-grammar.bnf'>
+ the www-consortium retains license rights to the respective bnf.
+ it is distributed herewith under the terms of their software license.</LICENSE>
+ <LICENSE href='file://xml/bnf/xpath-grammar.bnf'>
+ the www-consortium retains license rights to the respective bnf.
+ it is distributed herewith under the terms of their software license.</LICENSE>
+ <LICENSE href='file://xml/bnf/xql-grammar.bnf'>
+ the www-consortium retains license rights to the respective bnf.
+ it is distributed herewith under the terms of their software license.</LICENSE>
+ <LICENSE href='file://xml/demos/saxandsoap/*.lisp'>
+ <COPYRIGHT YEAR='2001' AUTHOR='Stanley Knutson' MARK='(C)'
+ mailto='knewt(a)alum.mit.edu' />
+ for information on this module, please contact the author.</LICENSE>
+ <CHRONOLOGY>
+ <!-- nb. this version number tracks that of the 'parser' module.
+ the others vary independently. -->
+ <DELTA DATE='20010605' AUTHOR='MS' VERSION='0.907'>
+ lispworks/ansi conformance</DELTA>
+ <DELTA DATE='20010608' VERSION='0.908'>
+ CL-HTTP in ALLEGRO</DELTA>
+ <DELTA DATE='20010621'>xml-writer</DELTA>
+ <DELTA DATE='20010702'>vector-stream moved to utils for data-url support</DELTA>
+ <DELTA DATE='20010910' VERSION='0.912'>xparser tokenizers</DELTA>
+ <DELTA DATE='20010910' VERSION='0.914'>0.912+lw/allegro tests</DELTA>
+ <DELTA DATE='20010918' VERSION='0.915'>first-level tokenization</DELTA>
+ <DELTA DATE='20011203' VERSION='0.916'>fixes for instance name compilation;<br />
+ lispworks comm package(including conditionalization 20020115)</DELTA>
+ <DELTA DATE='20020117'>lispworks charachter element set for two-byte characters</DELTA>
+ <DELTA DATE='20030408' VERSION='0.949'>
+ </CHRONOLOGY>
+ </DOCUMENTATION>
+|#
+
+(in-package "CL-USER")
+
+(eval-when (:load-toplevel :compile-toplevel :execute)
+ (let* ((defaults
+ #+allegro (or *load-truename* *load-pathname* *compile-file-truename*)
+ #+ccl *load-truename*
+ #+cmu *load-truename*
+ #+cormanlisp #p"d:\\Source\\Lisp\\XML-0-918\\sysdcl.lisp"
+ #+lispWorks (truename (lw:current-pathname))
+ #+(and sbcl (not asdf)) (or *compile-file-pathname* *load-pathname* *default-pathname-defaults*)
+ #+(and sbcl asdf) (format nil "~acl-xml/" clc::*source-root*))
+ (bin-target nil)
+ (root-target (make-pathname :name :wild :type :wild :version :newest
+ :directory (append (pathname-directory defaults)
+ '(:wild-inferiors))
+ :defaults defaults)))
+ ;; w/o bootstrap lispworks collapsed the bin target to host and type
+ (setf (logical-pathname-translations "xml")
+ `(("root;**;*.*.*" ,root-target)))
+ (setf bin-target
+ (make-pathname :name :wild
+ :type (pathname-type (compile-file-pathname "xml:name.lisp"))
+ :version :newest
+ :defaults
+;; #-asdf
+;; (progn
+ #+digitool "xml:root;bin;digifasl;**;*.*.*"
+ #+(and mcl m68k) "xml:root;bin;digim68kfasl;**;*.*.*"
+ #+(and allegro allegro-version>= (not (version>= 6 0))) "xml:root;bin;acl5fasl;**;*.*.*"
+ #+(and allegro allegro-version>= (version>= 6 0)) "xml:root;bin;acl6fasl;**;*.*.*"
+ #+lispworks "xml:root;bin;lwfasl;**;*.*.*"
+ #+cormanlisp "xml:root;bin;corfasl;**;*.*.*"
+ #+openmcl "xml:root;bin;omclfasl;**;*.*.*"
+ #+cmu "xml:root;bin;cmuclfasl;**;*.*.*"
+ #+sbcl "xml:root;bin;sbclfasl;**;*.*.*"
+;; )
+;; #+asdf
+;; (progn
+;; (if (find-package :clc)
+;; (format nil "~acl-xml/bin/" clc::*fasl-root*)
+;; "xml:root;bin;sbclfasl;**;*.*.*")) ;; FIXME for non clc
+ ))
+ (when *load-verbose*
+ (format *trace-output* "~%load defaults: ~s.~%compile target: ~s."
+ defaults bin-target))
+ (setf (logical-pathname-translations "xml")
+ `(("**;*.bin.*" ,bin-target)
+ ("**;*.BIN.*" ,bin-target)
+ ("code;**;*.*.*" "xml:root;code;**;*.*.*")
+ ("root;**;*.*.*" ,root-target)
+ ("**;*.bnf.*" "xml:root;bnf;*.*.*")
+ ("**;*.BNF.*" "xml:root;bnf;*.*.*")
+ ("**;*.*.*" "xml:root;**;*.*.*")))
+
+ (unless (ignore-errors (LOGICAL-PATHNAME-TRANSLATIONS "Packages"))
+ (setf (logical-pathname-translations "Packages")
+ `(("**;*.bin.*" ,bin-target)
+ ("**;*.BIN.*" ,bin-target)
+ ("**;*.*.*" "xml:Library;**;*.*")
+ ("*.*.*" "xml:Library;**;*.*"))))
+ ))
+
+;; configuration
+;;
+
+#+CL-HTTP ;; nb. this check is effective in the fasl only
+(unless (find :cl-http *features*)
+ (warn "CL-HTTP not present."))
+
+;;
+;; network access
+#+(and MCL (not CL-HTTP) (not openmcl))
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (define-declaration values nil)
+ (define-declaration arglist nil)
+ (require "OPENTRANSPORT"))
+
+#+openmcl
+(progn
+ (define-declaration values nil)
+ (define-declaration arglist nil))
+
+#+(and ALLEGRO (not CL-HTTP))
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (require "SOCK"))
+#+LispWorks
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (require "comm"))
+
+;; to indicate whether or not to model names as symbols or as instances
+;; (pushnew :xml-symbols *features*)
+
+;; to specify the instance names should use tokenizers
+ (pushnew :nameset-tokenizer *features*)
+
+;; to indicate that all name and string characters are to be checked for legality
+;; (pushnew :xml-check-char-codes *features*)
+#+Allegro
+(when (< excl:real-char-code-limit 65535)
+ (pushnew :xml-check-char-codes *features*))
+
+#-Allegro
+(when (< char-code-limit 65535)
+ (pushnew :xml-check-char-codes *features*))
+
+#|
+;; 20020410.jaa setting the value globally turns out to be inappropriate.
+;; the alternative, dynamical binding, is said to be insufficient to affect internal
+;; state.
+#+LispWorks
+(lw:set-default-character-element-type 'lw:simple-char)
+
+;; should that change, the alternative would have been
+#+LispWorks ; cause lispworks to use wide-character strings
+(lw:*default-character-element-type* 'lw:simple-char)
+|#
+
+#+cmu
+(progn
+ (require :gray-streams)
+ (setq extensions:*inline-expansion-limit* 2)
+ )
+
+#+sbcl
+(setq *inline-expansion-limit* 2)
+
+#|#+ccl ; 0.918 in 5.0b
+(setq CCL::*CHECK-SLOT-TYPE* nil)|#
+
+;; the atn-bnf parser must be loaded in order to translate grammars,
+;; for regular expressions, and for validation. this is reflected in it presence
+;; in the :xparser definition below.
+;; nb. this should be refined to load only the minimum for runtime use
+
+(eval-when (:compile-toplevel :execute :load-toplevel)
+
+ (define-system
+ (:base)
+ ()
+ "xml:code;patch;cmucl"
+ "xml:library;de;setf;utility;package"
+ "xml:library;de;setf;utility;string"
+ "xml:library;de;setf;utility;conditions"
+ "xml:library;de;setf;utility;test"
+ "xml:code;base;package"
+ )
+
+ (define-system
+ (:bnfp)
+ ()
+ :base
+ ; merged into common package file "xml:code;packages;atn-package"
+ "xml:code;atn-parser;clifs;inference-system-classes"
+ "xml:code;atn-parser;clifs;inference-units"
+ "xml:code;atn-parser;atn-parameters"
+ "xml:code;atn-parser;atn-classes"
+ "xml:code;atn-parser;atn-macros"
+ "xml:code;atn-parser;ebnf-tokenizer"
+ "xml:code;atn-parser;ebnf-to-atn-translator"
+ "xml:code;atn-parser;atn-macro-to-canonic-form"
+ "xml:code;atn-parser;ebnf-grammar.atn" ;; the bnf grammar is coded in a "atn" syntax lisp file.
+ "xml:code;atn-parser;atn-runtime"
+ "xml:code;atn-parser;conditions"
+ "xml:code;atn-parser;atn-lisp-compiler"
+ "xml:code;atn-parser;atn-regex"
+ ;; the java translator is present here as documentation, as of 20010208 it has
+ ;; not been reintegrated with the changes to compile to lisp.
+ #+bnfp-java "xml:code;atn-parser;atn-java-compiler"
+ )
+
+ (define-system
+ (:xutil :description "xml base utilities")
+ ()
+ :bnfp
+ "xml:code;base;parameters"
+ "xml:code;base;cllib"
+ #+CL-HTTP "xml:code;base;cl-http-utils"
+ "xml:code;base;utils"
+ "xml:code;base;parsetable"
+ "xml:code;base;vector-stream"
+ #-CL-HTTP "xml:code;base;www-utils-ersatz"
+ #-CL-HTTP "xml:code;base;tokenizer"
+ "xml:code;base;conditions")
+
+ (define-system
+ (xqdm :description "model from the x-query data model")
+ ()
+ :xutil
+ ;; for 0.918 namespaces operations must be defined first
+ "xml:code;xquerydatamodel;xqdm-namespaces"
+ "xml:code;xquerydatamodel;xqdm-parameters"
+ "xml:code;xquerydatamodel;xqdm-character-classes"
+ "xml:code;xquerydatamodel;xqdm-classes"
+ "xml:code;xquerydatamodel;xsd-types"
+ "xml:code;xquerydatamodel;conditions;names;conditions"
+ "xml:code;xquerydatamodel;conditions;node;conditions"
+ "xml:code;xquerydatamodel;conditions;model;conditions"
+ "xml:code;xquerydatamodel;xqdm-operators"
+ ;; "xml:code;xquerydatamodel;xqdm-qnames"
+ "xml:code;xquerydatamodel;xqdm-validation"
+ "xml:code;xquerydatamodel;qname-resolution"
+ "xml:code;xquerydatamodel;xqdm-graph"
+ "xml:code;xquerydatamodel;node-path-walk"
+ "xml:code;xquerydatamodel;xqdm-walk"
+ "xml:code;xquerydatamodel;xqdm-walk-accessors")
+
+ (define-system
+ (xparser :description "xml processor: parsing/serialization for xqdm with standard encoding")
+ ()
+ :xutil :xqdm
+ "xml:code;xparser;xml-parameters"
+ "xml:code;xparser;conditions;codec;conditions"
+ "xml:code;xparser;xml-stream-coding"
+ "xml:code;xparser;xml-operators"
+ "xml:code;xparser;xml-readers"
+ "xml:code;xparser;xml-tokenizer"
+ "xml:code;xparser;xml-processing-instruction"
+ "xml:code;xparser;xml-constructors"
+ "xml:code;xparser;xml-parser"
+ "xml:code;xparser;xml-printer"
+ "xml:code;xparser;xml-writer")
+
+ (define-system
+ (:xpath :description "xml path model and encoding to extend the processor")
+ ()
+ :xparser
+ "xml:code;xpath;xpath-parameters"
+ "xml:code;xpath;xpath-tokenizer"
+ "xml:code;xpath;xpath-classes"
+ "xml:code;xpath;xpath-operators"
+ "xml:code;xpath;xpath-constructors"
+ "xml:code;xpath;xpath-parser"
+ "xml:code;xpath;xpath-printer"
+ "xml:code;xpath;xpath-library")
+
+ (define-system
+ (:xquery :description "xml query processor based on xml processor and xml path")
+ ()
+ :xparser :xpath
+ "xml:code;xquery;xq-parameters"
+ "xml:code;xquery;xqa-classes"
+ "xml:code;xquery;xqa-operators"
+ "xml:code;xquery;xql-operators"
+ "xml:code;xquery;xqa-library"
+ "xml:code;xquery;xql-library"
+ "xml:code;xquery;xql-tokenizer"
+ "xml:code;xquery;xql-constructors"
+ "xml:code;xquery;xql-parser"
+ "xml:code;xquery;xq-printer"
+ )
+
+ (define-system
+ (:xtests
+ :description
+ "loads test files")
+ ()
+ :xparser
+
+ "xml:tests;xquerydatamodel;model"
+
+ "xml:tests;parser;bom"
+ "xml:tests;parser;document-internal"
+ "xml:tests;parser;document-external"
+ "xml:tests;parser;document-specialized"
+ "xml:tests;parser;qnames.lisp"
+ "xml:tests;parser;validation.lisp"
+ "xml:tests;parser;namespaces.lisp"
+ "xml:tests;parser;oasis.lisp"
+ )
+
+ (define-system
+ (:xrelease
+ :description
+ "loads test files")
+ ()
+ :xtests
+ "xml:code;base;release"
+ "xml:*.lisp"
+ "xml:demos;**;*.*"
+ "xml:library;define-system.lisp"
+ "xml:**;*.bnf"
+ "xml:**;*.htm"
+ "xml:**;*.gif"
+ "xml:**;*.xql"
+ "xml:**;*.xml*"
+ "xml:**;*.dtd"
+ "xml:**;*.xmlq"
+ "xml:**;*.txt"
+ )
+
+ (define-system
+ (:xconformance
+ :description
+ "incorporates conformance data files")
+ ()
+ "xml:standards;XML;XMLConf;**;*.xml"
+ "xml:standards;XML;XMLConf;**;*.mod"
+ "xml:standards;XML;XMLConf;**;*.dtd"
+ "xml:standards;XML;XMLConf;**;*.ent"
+ "xml:standards;XML;REC-xml-20001006.xml"
+ "xml:standards;XML;xmlspec-v21.dtd"
+ "xml:standards;XML;W3CSchema;*.xsd"
+ "xml:standards;XML;W3CSchema;*.dtd"
+ "xml:standards;XML;XHTML-MODULAR;**;*.*"
+ )
+ )
+
+
+;; see also xml:tests;test.lisp
+;; (load "entwicklung@paz:sourceServer:lisp:xml:define-system.lisp")
+;; (register-system-definition :xparser "entwicklung@paz:sourceServer:lisp:xml:sysdcl.lisp")
+;; (execute-system-operations :xutil '(:load))
+;; (execute-system-operations :xparser '(:load))
+
+;; to test if the pathnames are ok.
+;; (execute-system-operations :xparser '(:probe))
+
+;; to load
+;; (execute-system-operations :xparser '(:load))
+;; (execute-system-operations :xquery '(:load))
+
+;; to compile / load
+;; (execute-system-operations :xparser '(:compile))
+;; (execute-system-operations :xparser '(:compile :load))
+;; (execute-system-operations :xquery '(:compile :load))
+
+;; (execute-system-operations :xquery #'print)
+
+;; (translate-logical-pathname "xml:xxx;yyy;xml-grammar.bnf")
+;; (translate-logical-pathname "xml:bnfp;sysdcl")
+;; (translate-logical-pathname "xml:code;xquery;xq-printer.lisp")
+;; (translate-logical-pathname "xml:code;xquery;xq-printer.bin")
+;; (translate-logical-pathname "xml:demo;xq-printer.lisp")
+;; (translate-logical-pathname "xml:demo;xq-printer.bin")
+
+:EOF
1
0