attribute 用法 section 部分

attribute 用法 section 部分
attribute 用法 section 部分

attribute 用法section 部分

1. gcc的__attribute__编译属性

要了解Linux Kernel代码的分段信息,需要了解一下gcc的__attribute__的编绎属性,__attribute__主要用于改变所声明或定义的函数或数据的特性,它有很多子项,用于改变作用对象的特性。比如对函数,noline将禁止进行内联扩展、noreturn表示没有返回值、pure表明函数除返回值外,不会通过其它(如全局变量、指针)对函数外部产生任何影响。但这里我们比较感兴趣的是对代码段起作用子项section。

__attribute__的section子项的使用格式为:

__attribute__((section("section_name")))

其作用是将作用的函数或数据放入指定名为"section_name"输入段。

这里还要注意一下两个概念:输入段和输出段

输入段和输出段是相对于要生成最终的elf或binary时的Link过程说的,Link过程的输入大都是由源代码编绎生成的目标文件.o,那么这些.o 文件中包含的段相对link过程来说就是输入段,而Link的输出一般是可执行文件elf或库等,这些输出文件中也包含有段,这些输出文件中的段就叫做输出段。输入段和输出段本来没有什么必然的联系,是互相独立,只是在Link过程中,Link程序会根据一定的规则(这些规则其实来源于Link Script),将不同的输入段重新组合到不同的输出段中,即使是段的名字,输入段和输出段可以完全不同。其用法举例如下:

int var __attribute__((section(".xdata"))) = 0;

这样定义的变量var将被放入名为.xdata的输入段,(注意:__attribute__这种用法中的括号好像很严格,这里的几个括号好象一个也不能少。)

static int __attribute__((section(".xinit"))) functionA(void)

{

.....

}

这个例子将使函数functionA被放入名叫.xinit的输入段。

需要着重注意的是,__attribute__的section属性只指定对象的输入段,它并不能影响所指定对象最终会放在可执行文件的什么段。

2. linux Kernel源代码中与段有关的重要宏定义

A. 关于__init、__initdata、__exit、__exitdata及类似的宏

打开Linux Kernel源代码树中的文件:include/init.h,可以看到有下面的宏定议:

#define __init __attribute__ ((__section__ (".init.text"))) __cold

#define __initdata __attribute__ (( __section__ (".init.data")))

#define __exitdata __attribute__ (( __section__ (".exit.data")))

#define __exit_call __attribute_used__ __attribute__ (( __section__ (".exitcall.exit"))) #define __init_refok oninline __attribute__ ((__section__ (".text.init.refok")))

#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))

#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok"))) .........

#ifdef MODULE

#define __exit __attribute__ (( __section__ (".exit.text"))) __cold

#else

#define __exit __attribute_used__ __attribute__ ((__section__ (".exit.text"))) __cold

#endif

对于经常写驱动模块或翻阅Kernel源代码的人,看到熟悉的宏了吧:__init, __initdata, __exit, __exitdata。

__init 宏最常用的地方是驱动模块初始化函数的定义处,其目的是将驱动模块的初始化函数放入名叫.init.text的输入段。对于__initdata来说,用于数据定义,目的是将数据放入名叫.init.data的输入段。其它几个宏也类似。另外需要注意的是,在以上定意中,用__section__代替了section。还有其它一些类似的宏定义,这里不一一列出,其作用都是类似的。

B. 关于initcall的一些宏定义

在该文件中,下面这条宏定议更为重要,它是一条可扩展的宏:

#define __define_initcall(level,fn,id) \

static initcall_t __initcall_##fn##id __attribute_used__ \

__attribute__ ((__section__(".initcall" level ".init"))) = fn

这条宏带有3个参数:level,fn, id,分析该宏可以看出:

1.其用来定义类型为initcall_t的static函数指针,函数指针的名称由参数fn和id决定:__initcall_##fn##id,这就是函数指针的名称,它其实是一个变量名称。从该名称的定义方法我们其学到了宏定义的一种高级用法,即利用宏的参数产生名称,这要借助于"##"这一符号组合的作用。

2. 这一函数指针变量放入什么输入段呢,请看__attribute__ ((__section__ (".initcall" levle ".init"))),输入段的名称由level决定,如果level="1",则输入段是.initcall1.init,如果level="3s",则输入段是.initcall3s.init。这一函数指针变量就是放在用这种方法决定的输入段中的。

3. 这一定义的函数指针变量的初始值是什么叫,其实就是宏参数fn,实际使用中,fn 其实就是真实定义好的函数。

该宏定义并不直接使用,请看接下来的这些宏定义:

#define pure_initcall(fn) __define_initcall("0",fn,0)

#define core_initcall(fn) __define_initcall("1",fn,1)

#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)

#define postcore_initcall(fn) __define_initcall("2",fn,2)

#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s)

#define arch_initcall(fn) __define_initcall("3",fn,3)

#define arch_initcall_sync(fn) __define_initcall("3s",fn,3s)

#define subsys_initcall(fn) __define_initcall("4",fn,4)

#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s)

#define fs_initcall(fn) __define_initcall("5",fn,5)

#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s)

#define rootfs_initcall(fn) __define_initcall("rootfs",fn,rootfs)

#define device_initcall(fn) __define_initcall("6",fn,6)

#define device_initcall_sync(fn) __define_initcall("6s",fn,6s)

#define late_initcall(fn) __define_initcall("7",fn,7)

#define late_initcall_sync(fn) __define_initcall("7s",fn,7s)

这些宏定义出来是为了方便的使用__define_initcall宏定义的,上面每条宏第一次使用时都会产生一个新的输入段。

接下来还有一条

#define __initcall(fn) device_initcall(fn)

这一条其实只是定义了另一个别名,即平常使用的__initcall其实就是这儿的

device_initcall,用它定义的函数指定位于段.initcall6.init中。

C. __setup宏的来源及使用

__setup这条宏在Linux Kernel中使用最多的地方就是定义处理Kernel启动参数的函数及数据结构,请看下面的宏定义:

#define __setup_param(str, unique_id, fn, early) \

static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \

static struct obs_kernel_param __setup_##unique_id \

__used __section(.init.setup) \

__attribute__((aligned((sizeof(long))))) \

= { __setup_str_##unique_id, fn, early }

#define __setup(str, fn) \

__setup_param(str, fn, fn, 0)

使用Kernel中的例子分析一下这两条定义:

__setup("root=",root_dev_setup);

这条语句出现在init/do_mounts.c中,其作用是处理Kernel启动时的像

root=/dev/mtdblock3之类的参数的。

分解一下这条语句,首先变为:

__setup_param("root=",root_dev_setup,root_dev_setup,0);

继续分解,将得到下面这段代吗:

static char __setup_str_root_dev_setup_id[] __initdata __aligned(1) = "root="; static struct obs_kernel_param __setup_root_dev_setup_id

__used __section(.init.setup)

__attribute__((aligned((sizeof(long)))))

= { __setup_str_root_dev_setup_id, root_dev_setup, 0 };

这段代码定义了两个变量:字符数组变量__setup_str_root_dev_setup_id,其初始化内容为"root=",由于该变量用__initdata修饰,它将被放入.init.data输入段;另一变量是结构变量__setup_root_dev_setup_id,其类型为struct obs_kernel_param,该变理被放入输入段.init.setup中。结构struct obs_kernel_param也在该文件中定义如下:struct obs_kernel_param {

const char *str;

int (*setup_func)(char *);

int early;

};

变量__setup_root_dev_setup_id的三个成员分别被初始化为:

__setup_str_root_dev_setup_id --> 前面定义的字符数组变量,初始内容为"root="。root_dev_setup --> 通过宏传过来的处理函数。

0 -->常量0,该成员的作用以后分析。

现在不难想像内核启动时怎么处理启动参数的了:通过__setup宏定义obs_kernel_param 结构变量都被放入.init.setup段中,这样一来实际是使.init.setup段变成一张表,Kernel 在处理每一个启动参数时,都会来查找这张表,与每一个数据项中的成员str进行比较,如果完全相同,就会调用该数据项的函数指针成员setup_func所指向的函数(该函数是在使用__setup宏定义该变量时传入的函数参数),并将启动参数如root=后面的内容传给该处理函数

可参考:http://ohse.de/uwe/articles/gcc-attributes.html#func-fastcall

倒装用法归纳(部分-全部)

Unit5 Grammar Inversion(倒装) 英语部分倒装用法归纳(Partial Inversion) 1. 否定副词位于句首时的倒装 在正式文体中,never, seldom, rarely, little, hardly, scarcely, no sooner, no longer, nowhere 等含有否定意义的副词若位于句首,则其后要用部分倒装: I shall never forgive him. / Never shall I forgive him. 我永远不会宽恕他。 He seldom goes out for dinner. / Seldom does he go out for dinner. 他很少出去吃饭。 She hardly has time to listen to music. / Hardly does she have time to listen to music. 她几乎没时间听音乐。 He little realizes how important this meeting is. / Little does he realize how important this meeting is. 他不甚明白这个会议的重要性。 We had no sooner reached the airport than the plane took off. / No sooner had we reached the airport than the plane took off. 我们刚到机场,飞机就起飞了。 【注意】 (1)对于not…until句型,当not until…位于句首时,其后的主句要用倒装语序: He didn’t leave the r oom until the rain stopped. / Not until the rain stopped did he leave the room. 雨停了之后他才离开这房间。 (2)某些起副词作用的介词短语,由于含有否定词,若位于句首,其后要用部分倒装: On no accounts must this switch be touched. 这个开关是绝不能触摸的。 In [Under] no circumstances will I lend money to him.无论如何我也不会再借钱给他了。 但是,in no time(立即,马上)位于句首时,其后无需用倒装语序: In no time he worked out the problem. 他马上就算出了那道题。 2.“only+状语”位于句首时的倒装 当一个状语受副词only的修饰且置于句首时,其后用部分倒装语序: Only then did he realize that he was wrong. 到那时他才意识到他错了。 Only in this way are you able to do it well. 你只有用这种方法才能把它做好。 Only when he returned home did he realize what had happened. 当他回到家里时,才知道出了什么事。 3. “so+adj. / adv.”位于句首时的倒装 副词so后接形容词或副词位于句首时,其后用部分倒装: So cold was the weather that we had to stay at home. 天气太冷,我们只好呆在家里。 So fast does light travel that we can hardly imagine its speed. 光速很快,我们几乎没法想像它的速度。 So sudden was the attack that we had no time to escape. 袭击来得非常突然,我们来不及逃跑。 4.“so+助动词+主语”倒装 当要表示前面提出的某一肯定的情况也同样适合于后者,通常就要用“So+助动词+主语”这种倒装结构: You are young and so am I. 你年轻,我也年轻。 She likes music and so do I. 她喜欢音乐,我也喜欢。

倒装句用法及例句

倒装句用法及例句 1.涉及only的倒装及考题分析 按英语习惯同,当“only+状语”位于句首时,其后句子要用部分倒装。如: Only then did he realize that he was wrong. 到那时他才意识到他错了。 Only in this way are you able to do it well. 你只有用这种方法才能把它做好。 Only in this way can our honour be saved. 只有这样,才能保住我们的荣誉。 Only then did I understand what she meant. 只有到那时我才明白她的意思。 Only after her death was I able to appreciate her. 只有到她死后我才认识到她的价值。 Only when he returned home did he realize what had happened. 当他回到家里时,才知道出了什么事。 Only in this way can we learn English. 只有这样才能学会英语(from .yygramma r.)。 The pilot reassured the passengers. Only then did I realize how dangerous t he situation had been. 飞机驾驶员要乘客们放心,这时我才明白刚才的情况有多危险。 Only by shouting was he able to make himself heard. 他只有叫喊才能让别人听到他。 Only when we landed did we see how badly the plane had been damaged. 我们只是在着陆之后才看到飞机损坏的严重程度。 Only on one point do I agree with you. 只有一点,我同意你的说法。 【典型考题】(答案分别为DC) 1. Only then _________ how much damage had been caused. A. she realized B. she had realized C. had she realized D. did she realize 2. Only after my friend came _________. A. did the computer repaired B. be repaired the computer C. was the computer repaired D. the computer was repaired 特别说明:有时命题者不是利用位于句首的“only+状语”来考查倒装,而是倒过来,利用给定的倒装结构来考查对only的选择。如下面一题(答案选A):

英语倒装句用法

英语倒装句用法

英语倒装句用法 Pleasure Group Office【T985AB-B866SYT-B182C-BS682T-STT18】

倒装句用法总结归纳 一、部分倒装: 1.否定副词位于句首时的倒装 在正式文体中,never, seldom, rarely, little, hardly, scarcely, no sooner, no longer, nowhere等含有否定意义的副词若位于句首,则其后要用部分倒装: I shall never forgive him. / Never shall I forgive him. 我永远不会宽恕他。 He seldom goes out for dinner. / Seldom does he go out for dinner. 他很少出去吃饭。 He little realizes how important this meeting is. / Little does he realize how important this meeting is. 他不甚明白这个会议的重要性。 注意: (1) 对于not…until句型,当not until…位于句首时,其后的主句要用倒装语序: He didn’t leave the room until the rain stopped. / Not until the rain stopped did he leave the room. 雨停了之后他才离开这房间。 (2) 某些起副词作用的介词短语,由于含有否定词,若位于句首,其后要用部分倒装: On no accounts must this switch be touched. 这个开关是绝不能触摸的。 (3) 但是,in no time(立即,马上)位于句首时,其后无需用倒装语序: In no time he worked out the problem. 他马上就算出了那道题。 2.“only+状语”位于句首时的倒装 当一个状语受副词only的修饰且置于句首时,其后用部分倒装语序: Only then did he realize that he was wrong. 到那时他才意识到他错了。 Only in this way are you able to do it well. 你只有用这种方法才能把它做好。 3.“so+adj. / adv.”位于句首时的倒装 副词so后接形容词或副词位于句首时,其后用部分倒装: So cold was the weather that we had to stay at home. 天气太冷,我们只好呆在家里。 So sudden was the attack that we had no time to escape. 袭击来得非常突然,我们来不及逃跑。 4.“so+助动词+主语”倒装 当要表示前面提出的某一肯定的情况也同样适合于后者,通常就要用“So+助动词+主语”这种倒装结构: You are young and so am I. 你年轻,我也年轻。 If he can do it, so can I. 要是他能做此事,我也能。 注意: (1) 若前面提出某一否定的情况,要表示后者也属于同样的否定情况,则应将其中的so改为neither或nor: You aren’t young and neither am I. 你不年轻,我也不年轻。 She hasn’t read it and nor have I. 她没有读它,我也没有读。 (2) 注意该结构与表示强调或同意的“so+主语+特殊动词”结构的区别: "It was cold yesterday." "So it was." “昨天很冷。”“的确很冷。” "Father, you promised." "Well, so I did." “爸爸,你答应过的。”“嗯,是答应

英语倒装句的用法归纳

英语部分倒装用法归纳 1. 否定副词位于句首时的倒装 在正式文体中,never, seldom, rarely, little, hardly, scarcely, no sooner, no longer, nowhere 等含有否定意义的副词若位于句首, 则其后要用部分倒装: I shall never forgive him. / Never shall I forgive him. 我永远不会 宽恕他。 He seldom goes out for dinner. / Seldom does he go out for dinner. 他很少出去吃饭。 She hardly has time to listen to music. / Hardly does she have time to listen to music. 她几乎没时间听音乐。 He little realizes how important this meeting is. / Little does he realize how important this meeting is. 他不甚xx这个会议的重要 性。 We had no sooner reached the airport than the plane took off. / No sooner had we reached the airport than the plane took off. 我 们刚到机场,飞机就起飞了。 【注意】 (1) 对于not…until句型,当not until…位于句首时,其后的主句 要用倒装语序: He didn’t leave the room until the rain stopped. / Not until the rain stopped did he leave the room. 雨停了之后他才离开这房间。 (2) 某些起副词作用的介词短语,由于含有否定词,若位于句 首,其后要用部分倒装: On no accounts must this switch be touched. 这个开关是绝不能 触摸的。 In [Under] no circumstances will I lend money to him.无论如何我 也不会再借钱给他了。 但是,in no time(立即,马上)位于句首时,其后无需用倒装语

倒装句的用法总结

倒装句的用法总结 今天给大家带来倒装句的用法,让我们一起来学习吧。下面就和大家分享,来欣赏一下吧。 倒装句的用法 倒装有两种: 将主语和谓语完全颠倒过来,叫做完全倒装(Complete Inversion)。如:In came a man with a white beard. 只将助动词(包括情态动词)移至主语之前,叫做部分倒装(Partial Inversion)。如:Only once was John late to class. 英语句子的倒装一是由于语法结构的需要而进行的倒装,二是由于修辞的需要而进行的倒装。前一种情况,倒装是必须的,否则就会出现语法错误;后一种情况,倒装是选择性的,倒装与否只会产生表达效果上的差异。下面*就拟从其修辞功能谈谈倒装句的用法。 一、表示强调:

倒装句最突出、最常见的修辞效果就是强调,其表现形式如下: 1. only +状语或状语从句置于句首,句子用部分倒装。 eg.Only in this way can you solve this problem. 只有用这种方法,你才可以解决这个问题。 eg.Only after he had spoken out the word did he realize he had made a big mistake.只有当他已经说出那个字后才意识到自己犯了个大错误。 2. not, little, hardly, scarcely, no more, no longer, in no way, never, seldom, not only, no sooner等具有否定意义的词或词组位于句首,句子用部分倒装。 eg. No sooner had I got home than it beg.an to rain. 我刚到家就下起了雨。 eg. Seldom do I go to work by bus. 我很少乘公共汽车上班。 3. so / such...that结构中的so或such位于句首可以构成部分倒装句,表示强调so /such和that之间的部分。 eg.So unreasonable was his price that everybody startled. 他的要价太离谱,令每个人都瞠目结舌。

英语-倒装句用法

倒装句用法总结归纳 一、部分倒装: 1.否定副词位于句首时的倒装 在正式文体中,never, seldom, rarely, little, hardly, scarcely, no sooner, no longer, nowhere 等含有否定意义的副词若位于句首,则其后要用部分倒装: I shall never forgive him. / Never shall I forgive him. 我永远不会宽恕他。 He seldom goes out for dinner. / Seldom does he go out for dinner. 他很少出去吃饭。 He little realizes how important this meeting is. / Little does he realize how important this meeting is. 他不甚明白这个会议的重要性。 注意: (1) 对于not…until句型,当not until…位于句首时,其后的主句要用倒装语序: He didn’t leave the room until the rain stopped. / Not until the rain stopped did he leave the room.

雨停了之后他才离开这房间。 (2) 某些起副词作用的介词短语,由于含有否定词,若位于句首,其后要用部分倒装: On no accounts must this switch be touched. 这个开关是绝不能触摸的。 (3) 但是,in no time(立即,马上)位于句首时,其后无需用倒装语序: In no time he worked out the problem. 他马上就算出了那道题。 2.“only+状语”位于句首时的倒装 当一个状语受副词only的修饰且置于句首时,其后用部分倒装语序: Only then did he realize that he was wrong. 到那时他才意识到他错了。 Only in this way are you able to do it well. 你只有用这种方法才能把它做好。 3.“so+adj. / adv.”位于句首时的倒装

英语倒装句归纳

英语倒装句的用法 类型 1)部分倒装——助动词\情态动词+主语+谓语的实义动词型 2)全倒装——谓语+主语型 一、在以下结构中用全倒装:这种结构通常只用于一般现在时和一般过去时。常见的结构有: 1.在there be或者There live(stand,appear.seem,remain,exist….) 句型中;如: There are thousands of people on the square. 原语序:Thousands of people are there on the square. There lived an old fisherman in the village. 原语序:An old fisherman lived there in the village. There stands a little girl. 正常语序:A little girl stands there. 2.在“here, there, now, thus, then+动词+主语”的句子中,(谓语动词为be, go, come, lie, run等,主 语为名词); Now comes my turn. There goes the bell. Then came the order to leave. Here comes a bus= A bus comes here. 3.在“out\ in, up\ down, off\away,in the distance,on the hill,round the corner”等表示方向性的副词或表示地点的介词词组位于句首,且主语又是名词,谓语是表示运动的动词。 Away went the crowed one by one. In came a stranger in black. Out rushed the children.. Down fell the leaves. On the floor were piles of old books. ☆注意:主语必须是名词 eg: Out she went.There they are. Here he comes. 而Out went the girl. Here comes the boy. 4.有时为了强调表语,构成“表语+连系动词+主语”结构; Lucky is she who was chosen to be a leader.=She who was chosen to be a leader is lucky. Gone are the days when women were looked down upon! =The days when women were looked down upon are gone! 5、在某些表示愿望的祝愿语中,全倒装。 Long live the People's Republic of China! May you be happy! 二、在以下结构中用部分倒装 部分倒装是指将谓语的一部分如助动词或情态倒装至主语之前。如果句中的谓语没有助动词或情态动词,则需添加助动词do, does或did,并将其置于主语之前。 1.含有否定或半否定意义的词语(如:not,never,seldom,hardly,little,scarcely,barely,few…);或者含有否定结构的连词(not only…but also.., neither..nor.., no sooner had…than...(一。。。就。。。),scarely..than.., Hardly had...when.., not until...;nowhere等);或否定意义的介词词组(by no means(决不),in no case\way(任何情况下都不),with no method, at no time(决不), on no account(决不),under no circumstances\condition...(任何情况下都不))位于句首eg: I have never seen him before.=Never have I seen him before. Not a word did he say when he left. Seldom/Scarecely does he go to that park. Hardly(几乎不。。。) do I speak to him. Little English can he speak. Little does he realize the importance of the meeting. Few people did I see in the street. 含有否定结构的连词:

英语倒装句地用法

英语倒装句的用法 英语句子按主谓排列顺序来分有正常语序和倒装语序。正常语序的结构是“主语+谓语”,倒装语序为“谓语(或谓语的一部分)+主语”。 1)部分倒装---- 助动词\情态动词+主语+谓语的实义动词型 2)全倒装---- 谓语+主语型 在以下结构中用全倒装 此结构通常只用与一般现在时和一般过去时。常见的结构有: 1.在there be或者There live(stand,appear.seem,remain,exist….) 句型中; 如There are thousands of people on the square. Thousands of people are there on the square. There lived an old fisherman in the village. 原语序:An old fisherman lived there in the village. There stands a little girl. 正常语序:A little girl stands there. 2.在“here, there, now, thus, the n+动词+主语”的句子中,(谓语动词为be, go, come, lie, run等转移动词一起连用,主语为名词); 如: Now comes my turn. There goes the bell. Then came the order to leave. Here comes a bus= A bus comes here. A)此类倒装不用进行时态。Here comes a taxi! There goes the last train! 有辆出租车来了! 最后一班火车开走了! (注意这里不可用进行时) B)上述全部倒装的句型结构的主语必须是名词,如果主语是人称代词则不能完全倒装。Here it comes! There it goes! 3.在“out\ in, up\ down, off\away,in the distance,on the hill,round the corner”等表示方向性的副词或表示地点的介词词组位于句首,且主语又是名词,谓语是表示运动的动词。 Away went the crowed one by one. In came a stranger in black. Out rushed the children.. Down fell the leaves. On the floor were piles of old books. ☆注意:主语必须是名词 eg: Out she went.There they are. Here he comes. 而Out went the girl. Here comes the boy. 地点状语后面如有表示位置的动词 (如lie, live, sit, stand) 或转移的动词 (如c ome, go, rise),用作主语的名词可以放在动词之后。这种情形主要出现在描写文中。如:At the top of the hill stood the tiny chapel. 那座小教堂矗立在山顶上。 In the fields of poppies lay the dying soldiers. 罂粟地里躺着奄奄一息的士兵们。

许老师(原创) 英语部分倒装用法归纳(例句丰富)

倒装句:英语部分倒装用法归纳 1. 否定副词位于句首时的倒装 在正式文体中,never, seldom, rarely, little, hardly, scarcely, no sooner, no longer, nowhere 等含有否定意义的副词若位于句首,则其后要用部分倒装:I shall never forgive him. / Never shall I forgive him. 我永远不会宽恕他。He seldom goes out for dinner. / Seldom does he go out for dinner. 他很少出去吃饭。 She hardly has time to listen to music. / Hardly does she have time to listen to music. 她几乎没时间听音乐。 He little realizes how important this meeting is. / Little does he realize how important this meeting is. 他不甚明白这个会议的重要性。 We had no sooner reached the airport than the plane took off. / No sooner had we reached the airport than the plane took off. 我们刚到机场,飞机就起飞了。 【注意】 (1) 对于not…until句型,当not until…位于句首时,其后的主句要用倒装语序: He didn't leave the room until the rain stopped. / Not until the rain stopped did he leave the room. 雨停了之后他才离开这房间。 (2) 某些起副词作用的介词短语,由于含有否定词,若位于句首,其后要用部分倒装: On no accounts must this switch be touched. 这个开关是绝不能触摸的。 In [Under] no circumstances will I lend money to him.无论如何我也不会再借钱给他了。 但是,in no time(立即,马上)位于句首时,其后无需用倒装语序: In no time he worked out the problem. 他马上就算出了那道题。 2.“only+状语”位于句首时的倒装 当一个状语受副词only的修饰且置于句首时,其后用部分倒装语序: Only then did he realize that he was wrong. 到那时他才意识到他错了。Only in this way are you able to do it well. 你只有用这种方法才能把它做好。Only when he returned home did he realize what had happened. 当他回到家里时,才知道出了什么事。 3. “so+adj. / adv.”位于句首时的倒装 副词so后接形容词或副词位于句首时,其后用部分倒装: So cold was the weather that we had to stay at home. 天气太冷,我们只好呆在家里。 So fast does light travel that we can hardly imagine its speed. 光速很快,我们几乎没法想像它的速度。 So sudden was the attack that we had no time to escape. 袭击来得非常突然,我们来不及逃跑。 4.“so+助动词+主语”倒装 当要表示前面提出的某一肯定的情况也同样适合于后者,通常就要用“So+助动词+主语”这种倒装结构: You are young and so am I. 你年轻,我也年轻。 She likes music and so do I.

英语倒装句的用法讲解

英语倒装句的用法讲解 倒装是一种语法手段,用于表示一定的句子结构或强调某一句子成分。倒装句有两种:完全倒装和部分倒装。 完全倒装 1) 完全倒装即把整个谓语放到主语之前(是整个谓语动词,而非助动词)。 例如:The teacher came in and the class began.(没有倒装) In came the teacher and the class began. (老师走了进来,然后开始上课。) 2) there引出的完全倒装句:除了最常见的there be句型以外,there还可以接appear, exist, lie, remain, seem to be, stand等,一般都译成"有"的含义,构成完全倒装句。 例如:There appeared to be a man in black in the distance.(远处有个穿黑色衣服的人。) 3) 由地点和时间副词引出的完全倒装句:以地点副词here, there和时间副词now, then 开头,后面的动词是be, come, exist, fall, follow, go, lie, remain, seem, stand等,而主语又是名词时,构成完全倒装句。Up climbed the boy when his mother came. 4)表示运动方向的副词或地点状语置于句首,谓语表示运动的动词且主语是名词时使用完全倒装 5)在强调状语时1)当句首状语为方位词或拟声词,谓语动词为go, come等表示位置转移的动词时句子须倒装。例如: 1 Up went the plane. 2 In came the chairman and the meeting began. 注:如果主语是代词则不发生倒装。例如: 1 Out they rushed! 2 Lower and lower he bent. (2) 当句首状语为表示地点的介词词组时,句子须倒装。例如: 1 Round the corner walked a large policeman. 2Under the table was lying a half-conscious young man. 3 当句首状语由“only +副词”,“only +介词词组”,“only +状语从句”构成时,句子须倒装。例如: 1 Only yesterday did he find out that his watch was missing. (不属于完全倒装) 2 Only because there were some cancelled bookings did he get some tickets in the end. (6)当句首状语为here, there, now, then等时,句子须倒装,主语是代词时,句子不用倒装。例如: 1)Here is a ticket for you. 2)Now comes your turn. 3)Here he comes. (7)以关联词so (…that)开头的句子中,句子须倒装。例如: 1)So small was the mark that I could hardly see it. 2)So quickly did the workmen finish their work that they were given a bonus. 3)So much does he worry about his f inancial position that he can’t sleep at night.

英语倒装句百科

主语和谓语是句子的核心,它们之间有两种语序: 一是主语在谓语之前称为自然语序(Natural Order); 二是主语在谓语之后则称为倒装语序(Inverted Order)。 而倒装语序中又有完全倒装(Full Inversion)和部分倒装(Partial Inversion) 完全倒装(Full Inversion):又称"全部倒装",是指将句子中的谓语动词全部置于主语之前。此结构通常只用于一般现在时和一般过去时。 部分倒装(Partial Inversion):指将谓语的一部分如助动词或情态动词倒装至主语之前,而谓语动词无变化。如果句中的谓语没有助动词或情态动词,则需添加助动词do, does或did,并将其置于主语之前。 英语句子的倒装一是由于语法结构的需要而进行的倒装,二是由于修辞的需要而进行的倒装。 前一种情况,倒装是必须的,否则就会出现语法错误;后一种情况,倒装是选择性的,倒装与否只会产生表达效果上的差异。 一、表示强调: 倒装句最突出、最常见的修辞效果就是强调,其表现形式如下: 1.only +状语或状语从句置于句首,句子用部分倒装。 例子: Only in this way can you solve this problem. 只有用这种方法,你才可以解决这个问题。 Only after he had spoken out the word did he realize he had made a big mistake. 只有当他已经说出那个字后才意识到自己犯了个大错误。 2. hardly, in no way, little, scarcely, seldom, never, no more, no longer, not, not only, no sooner, not only … (but also),not until… 等具有否定意义的词或词组位于句首,句子用部分倒装。 例子: No sooner had I got home than it began to rain. 我刚到家就下起了雨。 Seldom do I go to work by bus. 我很少乘公共汽车上班。 Not until twelve o'clock did she go to bed last night . 她昨晚十二点才上床睡觉。 3. so / such...that结构中的so或such位于句首可以构成部分倒装句,表示强调so /such和that之间的部分。 例子:

文言文倒装句 用法及例句

文言文倒装句用法及例句 优质解答 一、主谓倒装 主谓倒装句有三种情况:语气强烈的疑问句;语气强烈的感叹句;旧诗词为了韵律相合. ①子耶,言伐莒者? (言伐莒者,子耶?) ②甚矣,汝之不惠! (汝之不惠!甚矣!) ③美哉室! (室美哉!) ④大哉,尧之为君也! (尧之为君也,大哉!) ⑤灼灼其华. (其华灼灼) ⑥竹喧归浣女,莲动下渔舟. (竹喧

浣女归,莲动渔舟下.) ⑦安在公子能急人之困也? (公子能急人之困安在也!“在安”,宾语前置)⑧美哉,我少年中国! (我少年中国,美哉!) 以上例子分别体现了谓语前的三种情况:①⑦疑问句;②③④⑧感叹句;⑤⑥旧诗词合韵律. 二、定语后置 定语后置有下面四种情况: 1.中心语+定语+者 ①计未定,求人可使报秦者,未得. (求可使报秦者人) ②村中少年好事者,驯养一虫. (村中好事者少年)

③遂率子孙荷担者三夫. (遂率荷担者子孙三夫) ④太子及宾客知其事者,皆白衣冠以送之. (知其事者太子及宾客) ⑤人马烧溺死者甚众. (烧溺死者人马甚众) ⑥亦雁荡具体而微者. (亦具体而微者雁荡) ⑦客有吹洞箫者,倚歌而和之. (有吹洞箫者客) ⑧人马冻死者相望. (冻死者人马相望) ⑨当其时,巫行视小家女好者. (当其时,巫行视小家好者女) ⑩楚人有涉江者(有涉江者楚人)

2.中心语+之+定语 ,“之”是定语后置的标志. ①蚓无爪牙之利,筋骨之强. (蚓无利爪牙,强筋骨) ②居庙堂之高则忧其民,处江湖之远则忧其君.(居高庙堂则忧其民,处远江湖则忧其君) ③四海之大,有几人欤? (大四海,有几人欤?) ④带长铗之陆离兮,冠切云之崔嵬. (带陆离长铗,冠崔嵬切云——佩着长长的宝剑,戴着高高的切云帽)3.中心语+之(而)+定语+者,“之”是定语后置的标志 . ①石之铿然有声者,所在皆是也.

英语倒装句试题经典及解析

英语倒装句试题经典及解析 一、倒装句 1.-- He swam in the river this summer. -- ________ A. So did he. B. So she did. C. So did she. 【答案】 C 【解析】【分析】“so+助动词(情态动词或连系动词)+另一主语”,此句型是主谓倒装 结构,可以表示前面的情况也适用于后者,使用该句型需要注意以几个方面的问题: 1.该句型只能用于肯定句,不能用于否定句:如果前句是否定句,则要用“neither /nor +助动词+主语”。2.句型中的主语与上文中的主语是不同的两个主语3.句型中助动词,包括连系动词和情态动词的时态要和上句中谓语动词的时态相一致。句意:这个夏 天,他在这条河中游泳了。她也游泳了。结合语境可知前文情况也适用于后者,故用主谓倒装结构,选C。 【点评】这几个倒装句的区别比较难。“so+助动词(情态动词或连系动词)+另一主 语”,表示前面的情况也适用于后者。So+主语+助动词(情态动词或连系动词)是对上文所 说的情况加以肯定。如果上文是否定形式则要将so换成neither。 2.—He's never been late for school. —________________. A. So have I B. So am I C. Neither have I D. Nor am I 【答案】 C 【解析】【分析】句意:—他从来没有上学迟到过。—我也没有。So+助动词+主语,表示主语也是;neither+助动词+主语,表示主语也不是这样;根据上文是现在完成时,这里用 助动词have。根据题意,故选C。 【点评】考查固定句型neither+谓+主。 3.—Oh, my god! Recently I have put on 5 pounds. — . I think I should lose weight. A. So do I B. So have I C. Neither do I D. Neither have I 【答案】 B 【解析】【分析】句意:—啊,我的天呀!最近我长胖了五磅。—我也是,我认为我应该 减减肥了。so +主语+助动词/情态动词/系动词:某某确实如此,主语与上文是同一人。So+助动词/情态动词/系动词+主语:某某也如此,主语与上文不是同一人,表示后者适合前 者。上文是否定句,下文表示某某也不,用 neither +助动词+主语。这些句式在时态上与前 一个句子相同。根据上句是肯定句,现在完成时态,主语与上句不同,故选B。 【点评】考查固定结构,牢记并熟练运用此结构,能举一反三,应对自如。

倒装用法总结

倒装句用法小结 一般来说,倒装分为全部倒装和部分倒装,有的倒装是因为语法需要而出现的,有的倒装则是因为结构平衡的需要而出现的。 一、完全倒装(主谓倒装)是指把谓语全部提到主语的前面。例:In a lecture hall of a university in England sits a professor. 1.以here, there,now, then引导的句子,要完全倒装。这种句子中的谓语动词通常是不及物动词。 如:Here comes the train! / There goes the bell! 注意:若代词作主语,只把该副词提前主谓语序不变。Here he comes . / Here it is . 2句首是拟声词或out , in , up ,away , down 等副词,句子要完全倒装。(注意,这时句子的主语也必须是名词。如果是人称代词,也不能使用倒装结构。)如:Up went the rocket. /Up it went. 3. 介词短语作状语在句首,句子要完全倒装。注意,这时句子的谓语动词通常是不及物动词。 如:In the front of the lecture hall sat the speaker. 4.表语置于句首,且主语较长或结构较复杂的句子要用全部倒装。如:Gone are the days when we ha nothing to eat. 5.so/ neither/ nor 表前面所说的情况也适合于后者,其倒装结构为“so/ neither/ nor+助动词/系动词/情态动词”,这里的主语同前一个句子的主语指的是同一人或物。如:She has finished her homework, so has her brother. She hasn’t gone there, neither/ nor has he. 二、部分倒装(助动词倒装)是指把谓语的一部分(助动词)提到主语的前面。例:Never in my life have I seen such a thing. 1.用于疑问句中。如:How did you do that? Did you see the film yesterday? 2. if 从句中如有were ( had , should ) , if 省去后,要部分倒装,把were,had,should提到主语前面。如: If you had come yesterday, you would have seen him. ---Had you come yesterday, you would have seen him. 3.as 引导的让步状语从句,要部分倒装(表语、状语倒装)。有以下几种形式: 1)副词置于句首。如:Much as I like it (=Although I like it very much), I will not buy it. 2)动词置于句首。如:Wait as you may (= Although you may wait), he will not see you. 3)形容词或名词置于句首。如:Proud as the nobles are (=Although the nobles are proud), they are afraid to see me. Child as he is (=Although he is a child), he can tell right from wrong. 注意:如果名词前有形容词修饰时,as引导的倒装句中要保留不定冠词。如: A bad-tempered man as he is (=Although he is a bad-tempered man), he loves me deeply. 4.句首为否定词或否定意义的词语时,句子要部分倒装。( not , not only , never , little , seldom , not until, hardly ( scarcely ) , no sooner, not once, at no time,... ) Little do we know about him. No sooner had he closed his eyes than he fell asleep. Seldom does he come back on Sundays. Not until he came back did I know about it. 5.only 在句首引导状语,或not until 引导的状语在句首,主句要部分倒装。如: Only then did I realize the important of Eng lish. / Only when a child grows up does he understand his parents’ intentions. 但若only修饰的是句子的其它成分,则无需倒装。如:Only socialism can save China. (only修饰句子的主语,仍用正常语序) 6.not only ... but also ... 引导两个并列句,前倒后不倒。如:

相关文档
最新文档